File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes What's the best way to write to a file. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "What Watch "What New topic
Author

What's the best way to write to a file.

Malith Yapa
Ranch Hand

Joined: Jan 17, 2007
Posts: 45
Hiya folks,
Well i was wondering what would be the best way to write out to a text file.
I tried the DataOutputStream and the writeUTF() method( Since none of the other methods are working) But i keep getting two unwanted bites at the beggining of the file. I want the file to be 100% accurate. Got any tips. Why won't the write() methods work? Thanks fellas. Cheers
Sam Bluesman
Ranch Hand

Joined: Nov 21, 2004
Posts: 188
Hi. If its a simple text file you could do something like...



Alterntively, you could use a random access file if you want to continually append an existing file...



The API will tell you how to skip to the end of the file etc to manipulate it as well as perform other functions on it, so look there!

Cheers
[ April 16, 2007: Message edited by: Sam Bluesman ]

Moosey knows best
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What's the best way to write to a file.
 
Similar Threads
java Excel
how to delete content from a text file?
XML Document
last println doesn't print anything
input file and output file