Skip to content

Commit bbfff58

Browse files
author
Stephen Colebourne
committed
Add section on LineIterator
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/io/trunk@383222 13f79535-47bb-0310-9956-ffa450edef68
1 parent 41461b8 commit bbfff58

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

xdocs/description.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,26 @@ limitations under the License.
172172

173173
</section>
174174

175+
<section name="Line iterator">
176+
<p>
177+
The <code>org.apache.commons.io.LineIterator</code> class
178+
provides a flexible way for working with a line-based file.
179+
An instance can be created directly, or via factory methods on
180+
<code>FileUtils</code> or <code>IOUtils</code>.
181+
The recommended usage pattern is:
182+
</p>
183+
<pre>
184+
LineIterator it = FileUtils.lineIterator(file, "UTF-8");
185+
try {
186+
while (it.hasNext()) {
187+
String line = it.nextLine();
188+
/// do something with line
189+
}
190+
} finally {
191+
LineIterator.closeQuietly(iterator);
192+
}</pre>
193+
</section>
194+
175195
<section name="File filters">
176196
<p>
177197
The <code>org.apache.commons.io.filefilter</code>

0 commit comments

Comments
 (0)