11<?xml version =" 1.0" ?>
22<!--
3- Copyright 2002-2005 The Apache Software Foundation.
3+ Copyright 2002-2006 The Apache Software Foundation.
44
55Licensed under the Apache License, Version 2.0 (the "License");
66you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@ limitations under the License.
2626 Commons-IO contains
2727 <a href =" #Utility classes" >utility classes</a >,
2828 <a href =" #Endian classes" >endian classes</a >,
29+ <a href =" #Line iterator" >line iterator</a >,
2930 <a href =" #File filters" >file filters</a > and
3031 <a href =" #Streams" >stream implementations</a >.
3132 </p >
@@ -49,29 +50,29 @@ limitations under the License.
4950 </p >
5051
5152 <source >
52- InputStream in = new URL( "http://jakarta.apache.org" ).openStream();
53- try {
54- InputStreamReader inR = new InputStreamReader( in );
55- BufferedReader buf = new BufferedReader( inR );
56- String line;
57- while ( ( line = buf.readLine() ) != null ) {
58- System.out.println( line );
59- }
60- } finally {
61- in.close();
62- }</source >
53+ InputStream in = new URL( "http://jakarta.apache.org" ).openStream();
54+ try {
55+ InputStreamReader inR = new InputStreamReader( in );
56+ BufferedReader buf = new BufferedReader( inR );
57+ String line;
58+ while ( ( line = buf.readLine() ) != null ) {
59+ System.out.println( line );
60+ }
61+ } finally {
62+ in.close();
63+ }</source >
6364
6465 <p >
6566 With the IOUtils class, that could be done with:
6667 </p >
6768
6869 <source >
69- InputStream in = new URL( "http://jakarta.apache.org" ).openStream();
70- try {
71- System.out.println( IOUtils.toString( in ) );
72- } finally {
73- IOUtils.closeQuietly(in);
74- }</source >
70+ InputStream in = new URL( "http://jakarta.apache.org" ).openStream();
71+ try {
72+ System.out.println( IOUtils.toString( in ) );
73+ } finally {
74+ IOUtils.closeQuietly(in);
75+ }</source >
7576
7677 <p >
7778 In certain application domains, such IO operations are
@@ -97,8 +98,8 @@ limitations under the License.
9798 For example to read an entire file line by line you could use:
9899 </p >
99100 <source >
100- File file = new File("/commons/io/project.properties");
101- List lines = FileUtils.readLines(file, "UTF-8");</source >
101+ File file = new File("/commons/io/project.properties");
102+ List lines = FileUtils.readLines(file, "UTF-8");</source >
102103 </subsection >
103104
104105 <subsection name =" FilenameUtils" >
@@ -113,9 +114,9 @@ limitations under the License.
113114 For example to normalize a filename removing double dot segments:
114115 </p >
115116 <source >
116- String filename = "C:/commons/io/../lang/project.xml";
117- String normalized = FilenameUtils.normalize(filename);
118- // result is "C:/commons/lang/project.xml"</source >
117+ String filename = "C:/commons/io/../lang/project.xml";
118+ String normalized = FilenameUtils.normalize(filename);
119+ // result is "C:/commons/lang/project.xml"</source >
119120 </subsection >
120121
121122 <subsection name =" FileSystemUtils" >
@@ -131,7 +132,7 @@ limitations under the License.
131132 For example to find the free space on a drive:
132133 </p >
133134 <source >
134- long freeSpace = FileSystemUtils.freeSpace("C:/");</source >
135+ long freeSpace = FileSystemUtils.freeSpace("C:/");</source >
135136 </subsection >
136137
137138 </section >
@@ -180,16 +181,16 @@ limitations under the License.
180181 <code >FileUtils</code > or <code >IOUtils</code >.
181182 The recommended usage pattern is:
182183 </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 >
184+ <source >
185+ LineIterator it = FileUtils.lineIterator(file, "UTF-8");
186+ try {
187+ while (it.hasNext()) {
188+ String line = it.nextLine();
189+ /// do something with line
190+ }
191+ } finally {
192+ LineIterator.closeQuietly(iterator);
193+ }</source >
193194 </section >
194195
195196 <section name =" File filters" >
0 commit comments