The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
January 2002



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Reading from a file

Posted by Hiran on January 16, 2002 at 11:02 PM

I was wondering what method I can use to read a message from a text file, and preserve the text? For example, if the contents I'm reading is:

How's it going?
From Dave

I want the read the contents exactly like that and store it in a string (preferrably), or a character array. I normally use BufferedReader's readLine method to read from text files, but that method skips newline and carriage return characters (which, as you can see, I want to keep in this case). Thanks in advance for the help.


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us