Author: scolebourne
Date: Sat Mar 4 15:19:02 2006
New Revision: 383221
URL: http://svn.apache.org/viewcvs?rev=383221&view=rev
Log:
Improve javadoc
Modified:
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java
Modified:
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java?rev=383221&r1=383220&r2=383221&view=diff
==============================================================================
---
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
(original)
+++
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
Sat Mar 4 15:19:02 2006
@@ -594,6 +594,7 @@
* @throws NullPointerException if source or destination is null
* @throws IOException if source or destination is invalid
* @throws IOException if an IO error occurs during copying
+ * @since Commons IO 1.2
*/
public static void copyDirectoryToDirectory(File srcDir, File destDir)
throws IOException {
if (srcDir == null) {
@@ -856,8 +857,8 @@
* The file is always closed.
* <p>
* There is no readFileToString method without encoding parameter because
- * the default encoding can differ between platforms and therefore results
- * in inconsistent results.
+ * the default encoding can differ between platforms and will have
+ * inconsistent results.
*
* @param file the file to read
* @param encoding the encoding to use, null means platform default
@@ -900,8 +901,8 @@
* The file is always closed.
* <p>
* There is no readLines method without encoding parameter because
- * the default encoding can differ between platforms and therefore results
- * in inconsistent results.
+ * the default encoding can differ between platforms and will have
+ * inconsistent results.
*
* @param file the file to read
* @param encoding the encoding to use, null means platform default
@@ -924,11 +925,24 @@
* Return an Iterator for the lines in a <code>File</code>.
* Please read the javadoc of [EMAIL PROTECTED] LineIterator} to understand
* whether you should close the iterator.
- * The file is closed if an exception is thrown.
+ * The file is closed if an exception is thrown during this method.
* <p>
- * There is no readLines method without encoding parameter because
- * the default encoding can differ between platforms and therefore results
- * in inconsistent results.
+ * The recommended usage patterm is:
+ * <pre>
+ * LineIterator it = FileUtils.lineIterator(file, "UTF-8");
+ * try {
+ * while (it.hasNext()) {
+ * String line = it.nextLine();
+ * /// do something with line
+ * }
+ * } finally {
+ * LineIterator.closeQuietly(iterator);
+ * }
+ * </pre>
+ * <p>
+ * There is no lineIterator method without encoding parameter because
+ * the default encoding can differ between platforms and will have
+ * inconsistent results.
*
* @param file the file to read
* @param encoding the encoding to use, null means platform default
@@ -955,8 +969,8 @@
* Writes a String to a file creating the file if it does not exist.
* <p>
* There is no writeStringToFile method without encoding parameter because
- * the default encoding can differ between platforms and therefore results
- * in inconsistent results.
+ * the default encoding can differ between platforms and will have
+ * inconsistent results.
*
* @param file the file to write
* @param data the content to write to the file
@@ -998,8 +1012,8 @@
* The specified character encoding and the default line ending will be
used.
* <p>
* There is no writeLines method without encoding parameter because
- * the default encoding can differ between platforms and therefore results
- * in inconsistent results.
+ * the default encoding can differ between platforms and will have
+ * inconsistent results.
*
* @param file the file to write to
* @param encoding the encoding to use, null means platform default
@@ -1018,8 +1032,8 @@
* The specified character encoding and the line ending will be used.
* <p>
* There is no writeLines method without encoding parameter because
- * the default encoding can differ between platforms and therefore results
- * in inconsistent results.
+ * the default encoding can differ between platforms and will have
+ * inconsistent results.
*
* @param file the file to write to
* @param encoding the encoding to use, null means platform default
Modified:
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?rev=383221&r1=383220&r2=383221&view=diff
==============================================================================
--- jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java
(original)
+++ jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java
Sat Mar 4 15:19:02 2006
@@ -511,7 +511,19 @@
* Return an Iterator for the lines in a <code>Reader</code>.
* Please read the javadoc of [EMAIL PROTECTED] LineIterator} to understand
* whether you should close the iterator.
- * The file is closed if an exception is thrown.
+ * <p>
+ * The recommended usage pattern is:
+ * <pre>
+ * LineIterator it = IOUtils.lineIterator(reader);
+ * try {
+ * while (it.hasNext()) {
+ * String line = it.nextLine();
+ * /// do something with line
+ * }
+ * } finally {
+ * LineIterator.closeQuietly(iterator);
+ * }
+ * </pre>
*
* @param reader the <code>Reader</code> to read from, not null
* @return an Iterator of the lines in the reader, never null
@@ -527,7 +539,19 @@
* the character encoding specified (or default encoding if null).
* Please read the javadoc of [EMAIL PROTECTED] LineIterator} to understand
* whether you should close the iterator.
- * The file is closed if an exception is thrown.
+ * <p>
+ * The recommended usage pattern is:
+ * <pre>
+ * LineIterator it = IOUtils.lineIterator(stream, "UTF-8");
+ * try {
+ * while (it.hasNext()) {
+ * String line = it.nextLine();
+ * /// do something with line
+ * }
+ * } finally {
+ * LineIterator.closeQuietly(iterator);
+ * }
+ * </pre>
*
* @param input the <code>InputStream</code> to read from, not null
* @param encoding the encoding to use, null means platform default
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]