This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Write File to Harddrive Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Write File to Harddrive" Watch "Write File to Harddrive" New topic

Write File to Harddrive

Mark Hughes
Ranch Hand

Joined: Jul 14, 2006
Posts: 146
Hey Guys;

I read in a file as follows;

Also i want to write the file back out to a new location;

I have that so far, but dont know what kind of format variable BufferedWriter wants, it wont accept ArrayList line and i cant put ArrayList lines into a file; Also how do i specify where to write the file on my harddrive and what to call it.
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
This way, comrade

I must add also that Jakarta Commons IO offers some IO utilities which do all that you want easier.

For instance, as simple as this:

Besides methods like copyFile(File srcFile, File destFile). Also, the IOUtils class have methods to copy files from one InputStream into an OutputStream or a Reader into a Writer or combinations of them.

Take a look at it.

I hope that helps!
[ July 27, 2006: Message edited by: Edwin Dalorzo ]
Mark Hughes
Ranch Hand

Joined: Jul 14, 2006
Posts: 146
Thanks, helps alot
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Write File to Harddrive
It's not a secret anymore!