How to read String from file
Last Updated on Saturday, 25 June 2011 08:05
|
The following example shows how to read string line by line of a text file using the default system encoding
|
For logging configuration you can use the following log4j.properties file |
Read a file line by line using Apache commons
Apache common IO offers a great utility class. LineIterator is an iterator over a the lines in a Reader

|
LineIterator holds a reference to an open Reader. When you have finished with the iterator you should close the reader to free internal resources. This can be done by closing the reader directly, or by calling the close() or closeQuietly(LineIterator) method on the iterator. |




