File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Java IO stream line break problem 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 "Java IO stream line break problem" Watch "Java IO stream line break problem" New topic
Author

Java IO stream line break problem

ImpulsEa Jany
Greenhorn

Joined: Jul 27, 2010
Posts: 1
this is the code that i use to write text in a text file in java.

the text variable is the JTextArea



the input is form a JTextArea reading the content of the JTextArea by line and writing it by line in a text file.

example: the text area contains
hello world
lets rock

when you open the text in notepad the output is still the same.
hello world
lets rock


but when i open the file in the text area in the program that i made the output becomes like this.
hello world

lets rock


a new line is added between the two lines of text.

here is the code for displaying the text in from the text file to the text area



the holdcont holds the content that will be displayed in the text area.
If i delete the new line code "\n" the output will be like this

hello worldlets rock

i want the output to be like this
hello world
lets rock

when i open the text file to the text area

someone please help me on finding another way on puting a new line on a text file PLEASE
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java IO stream line break problem