• Post Reply Bookmark Topic Watch Topic
  • New Topic

object outputstream

 
indira mandapati
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using objectoutputstream oops object to write string to a file :
FileOutputStream fis = new FileOutputStream("abc.tmp");
objectoutputstream oops =new objectoutputstream(fis);
oops.writeObject("hello");
oops.writeObject("how are you");
i see the the contents od abc.tmp as hello how are you.
i want the output to be
hello
how are you
what should i do for this.
 
Dale DeMott
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried using
"\nHow are you"
\n for the return character?
-Dale
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ObjectOutputStream should never be used to try to create a human-readable file. It is only useful for creating files that will be read using an ObjectInputStream - nothing else. Try using something like a PrintWriter wrapped around a FileWriter. (Maybe with a BuffereWriter in the middle.) That's probably the easiest way to write text tiles.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!