File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Writing Readable Text to a File Using Streams

 
Colin McGraw
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a simple question about Java file i/o. I want to write strings to a file such that what is in the string is all that is written to the file.
I've been using an ObjectOutputStream.writeUTF()/writeChars(), but doing so writes size information before each string or character, and the size information appears as nonsense characters when you open the file.
What object/ method do I want to use instead?
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a PrintWriter object and use println(). You can find the API here
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic