You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2013/04/25 01:24:20 UTC
svn commit: r1471767 [2/3] - in
/commons/proper/io/trunk/src/main/java/org/apache/commons/io: ./
filefilter/ input/ output/
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java?rev=1471767&r1=1471766&r2=1471767&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java Wed Apr 24 23:24:19 2013
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -115,7 +115,7 @@ public class IOUtils {
* The system line separator string.
*/
public static final String LINE_SEPARATOR;
-
+
static {
// avoid security issues
final StringBuilderWriter buf = new StringBuilderWriter(4);
@@ -126,7 +126,7 @@ public class IOUtils {
}
/**
- * The default buffer size ({@value}) to use for
+ * The default buffer size ({@value}) to use for
* {@link #copyLarge(InputStream, OutputStream)}
* and
* {@link #copyLarge(Reader, Writer)}
@@ -137,7 +137,7 @@ public class IOUtils {
* The default buffer size to use for the skip() methods.
*/
private static final int SKIP_BUFFER_SIZE = 2048;
-
+
// Allocated in the relevant skip method if necessary.
/*
* N.B. no need to synchronize these because:
@@ -157,10 +157,10 @@ public class IOUtils {
}
//-----------------------------------------------------------------------
-
+
/**
* Closes a URLConnection.
- *
+ *
* @param conn the connection to close.
* @since 2.4
*/
@@ -190,7 +190,7 @@ public class IOUtils {
* IOUtils.closeQuietly(in);
* }
* </pre>
- *
+ *
* @param input the Reader to close, may be null or already closed
*/
public static void closeQuietly(final Reader input) {
@@ -277,7 +277,7 @@ public class IOUtils {
public static void closeQuietly(final OutputStream output) {
closeQuietly((Closeable)output);
}
-
+
/**
* Closes a <code>Closeable</code> unconditionally.
* <p>
@@ -356,7 +356,7 @@ public class IOUtils {
* try {
* selector = Selector.open();
* // process socket
- *
+ *
* } catch (Exception e) {
* // error handling
* } finally {
@@ -376,7 +376,7 @@ public class IOUtils {
}
}
}
-
+
/**
* Closes a <code>ServerSocket</code> unconditionally.
* <p>
@@ -425,7 +425,7 @@ public class IOUtils {
* avoids unnecessary allocation and copy of byte[].<br>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
- *
+ *
* @param input Stream to be fully buffered.
* @return A fully buffered stream.
* @throws IOException if an I/O error occurs
@@ -438,7 +438,7 @@ public class IOUtils {
/**
* Returns the given reader if it is a {@link BufferedReader}, otherwise creates a BufferedReader from the given
* reader.
- *
+ *
* @param reader
* the reader to wrap or return (not null)
* @return the given reader or a new {@link BufferedReader} for the given reader
@@ -449,11 +449,11 @@ public class IOUtils {
public static BufferedReader toBufferedReader(final Reader reader) {
return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader);
}
-
+
/**
* Returns the given reader if it is already a {@link BufferedReader}, otherwise creates a BufferedReader from the given
* reader.
- *
+ *
* @param reader
* the reader to wrap or return (not null)
* @return the given reader or a new {@link BufferedReader} for the given reader
@@ -463,11 +463,11 @@ public class IOUtils {
public static BufferedReader asBufferedReader(final Reader reader) {
return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader);
}
-
+
/**
* Returns the given Writer if it is already a {@link BufferedWriter}, otherwise creates a BufferedWriter from the given
* Writer.
- *
+ *
* @param writer
* the Writer to wrap or return (not null)
* @return the given Writer or a new {@link BufferedWriter} for the given Writer
@@ -477,11 +477,11 @@ public class IOUtils {
public static BufferedWriter asBufferedWriter(final Writer writer) {
return writer instanceof BufferedWriter ? (BufferedWriter) writer : new BufferedWriter(writer);
}
-
+
/**
* Returns the given OutputStream if it is already a {@link BufferedOutputStream}, otherwise creates a BufferedOutputStream from the given
* OutputStream.
- *
+ *
* @param outputStream
* the OutputStream to wrap or return (not null)
* @return the given OutputStream or a new {@link BufferedOutputStream} for the given OutputStream
@@ -495,11 +495,11 @@ public class IOUtils {
}
return outputStream instanceof BufferedOutputStream ? (BufferedOutputStream) outputStream : new BufferedOutputStream(outputStream);
}
-
+
/**
* Returns the given InputStream if it is already a {@link BufferedInputStream}, otherwise creates a BufferedInputStream from the given
* InputStream.
- *
+ *
* @param inputStream
* the InputStream to wrap or return (not null)
* @return the given InputStream or a new {@link BufferedInputStream} for the given InputStream
@@ -513,7 +513,7 @@ public class IOUtils {
}
return inputStream instanceof BufferedInputStream ? (BufferedInputStream) inputStream : new BufferedInputStream(inputStream);
}
-
+
// read toByteArray
//-----------------------------------------------------------------------
/**
@@ -521,7 +521,7 @@ public class IOUtils {
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
- *
+ *
* @param input the <code>InputStream</code> to read from
* @return the requested byte array
* @throws NullPointerException if the input is null
@@ -540,7 +540,7 @@ public class IOUtils {
* <b>NOTE:</b> the method checks that the length can safely be cast to an int without truncation
* before using {@link IOUtils#toByteArray(java.io.InputStream, int)} to read into the byte array.
* (Arrays can have no more than Integer.MAX_VALUE entries anyway)
- *
+ *
* @param input the <code>InputStream</code> to read from
* @param size the size of <code>InputStream</code>
* @return the requested byte array
@@ -558,7 +558,7 @@ public class IOUtils {
return toByteArray(input, (int) size);
}
- /**
+ /**
* Gets the contents of an <code>InputStream</code> as a <code>byte[]</code>.
* Use this method instead of <code>toByteArray(InputStream)</code>
* when <code>InputStream</code> size is known
@@ -600,7 +600,7 @@ public class IOUtils {
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
- *
+ *
* @param input the <code>Reader</code> to read from
* @return the requested byte array
* @throws NullPointerException if the input is null
@@ -618,7 +618,7 @@ public class IOUtils {
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
- *
+ *
* @param input the <code>Reader</code> to read from
* @param encoding the encoding to use, null means platform default
* @return the requested byte array
@@ -641,7 +641,7 @@ public class IOUtils {
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
- *
+ *
* @param input the <code>Reader</code> to read from
* @param encoding the encoding to use, null means platform default
* @return the requested byte array
@@ -661,7 +661,7 @@ public class IOUtils {
* using the default character encoding of the platform.
* <p>
* This is the same as {@link String#getBytes()}.
- *
+ *
* @param input the <code>String</code> to convert
* @return the requested byte array
* @throws NullPointerException if the input is null
@@ -676,7 +676,7 @@ public class IOUtils {
/**
* Gets the contents of a <code>URI</code> as a <code>byte[]</code>.
- *
+ *
* @param uri
* the <code>URI</code> to read
* @return the requested byte array
@@ -692,7 +692,7 @@ public class IOUtils {
/**
* Gets the contents of a <code>URL</code> as a <code>byte[]</code>.
- *
+ *
* @param url
* the <code>URL</code> to read
* @return the requested byte array
@@ -713,7 +713,7 @@ public class IOUtils {
/**
* Gets the contents of a <code>URLConnection</code> as a <code>byte[]</code>.
- *
+ *
* @param urlConn
* the <code>URLConnection</code> to read
* @return the requested byte array
@@ -740,7 +740,7 @@ public class IOUtils {
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
- *
+ *
* @param is the <code>InputStream</code> to read from
* @return the requested character array
* @throws NullPointerException if the input is null
@@ -759,7 +759,7 @@ public class IOUtils {
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
- *
+ *
* @param is the <code>InputStream</code> to read from
* @param encoding the encoding to use, null means platform default
* @return the requested character array
@@ -783,7 +783,7 @@ public class IOUtils {
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
- *
+ *
* @param is the <code>InputStream</code> to read from
* @param encoding the encoding to use, null means platform default
* @return the requested character array
@@ -803,7 +803,7 @@ public class IOUtils {
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
- *
+ *
* @param input the <code>Reader</code> to read from
* @return the requested character array
* @throws NullPointerException if the input is null
@@ -824,7 +824,7 @@ public class IOUtils {
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
- *
+ *
* @param input the <code>InputStream</code> to read from
* @return the requested String
* @throws NullPointerException if the input is null
@@ -865,7 +865,7 @@ public class IOUtils {
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
- *
+ *
* @param input the <code>InputStream</code> to read from
* @param encoding the encoding to use, null means platform default
* @return the requested String
@@ -885,7 +885,7 @@ public class IOUtils {
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
- *
+ *
* @param input the <code>Reader</code> to read from
* @return the requested String
* @throws NullPointerException if the input is null
@@ -899,7 +899,7 @@ public class IOUtils {
/**
* Gets the contents at the given URI.
- *
+ *
* @param uri
* The URI source.
* @return The contents of the URL as a String.
@@ -914,7 +914,7 @@ public class IOUtils {
/**
* Gets the contents at the given URI.
- *
+ *
* @param uri
* The URI source.
* @param encoding
@@ -929,7 +929,7 @@ public class IOUtils {
/**
* Gets the contents at the given URI.
- *
+ *
* @param uri
* The URI source.
* @param encoding
@@ -947,7 +947,7 @@ public class IOUtils {
/**
* Gets the contents at the given URL.
- *
+ *
* @param url
* The URL source.
* @return The contents of the URL as a String.
@@ -962,7 +962,7 @@ public class IOUtils {
/**
* Gets the contents at the given URL.
- *
+ *
* @param url
* The URL source.
* @param encoding
@@ -982,7 +982,7 @@ public class IOUtils {
/**
* Gets the contents at the given URL.
- *
+ *
* @param url
* The URL source.
* @param encoding
@@ -1001,7 +1001,7 @@ public class IOUtils {
/**
* Gets the contents of a <code>byte[]</code> as a String
* using the default character encoding of the platform.
- *
+ *
* @param input the byte array to read from
* @return the requested String
* @throws NullPointerException if the input is null
@@ -1020,7 +1020,7 @@ public class IOUtils {
* <p>
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
- *
+ *
* @param input the byte array to read from
* @param encoding the encoding to use, null means platform default
* @return the requested String
@@ -1324,7 +1324,7 @@ public class IOUtils {
//-----------------------------------------------------------------------
/**
* Writes bytes from a <code>byte[]</code> to an <code>OutputStream</code>.
- *
+ *
* @param data the byte array to write, do not modify during output,
* null ignored
* @param output the <code>OutputStream</code> to write to
@@ -1344,7 +1344,7 @@ public class IOUtils {
* using the default character encoding of the platform.
* <p>
* This method uses {@link String#String(byte[])}.
- *
+ *
* @param data the byte array to write, do not modify during output,
* null ignored
* @param output the <code>Writer</code> to write to
@@ -1363,7 +1363,7 @@ public class IOUtils {
* using the specified character encoding.
* <p>
* This method uses {@link String#String(byte[], String)}.
- *
+ *
* @param data the byte array to write, do not modify during output,
* null ignored
* @param output the <code>Writer</code> to write to
@@ -1386,7 +1386,7 @@ public class IOUtils {
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#String(byte[], String)}.
- *
+ *
* @param data the byte array to write, do not modify during output,
* null ignored
* @param output the <code>Writer</code> to write to
@@ -1407,7 +1407,7 @@ public class IOUtils {
/**
* Writes chars from a <code>char[]</code> to a <code>Writer</code>
* using the default character encoding of the platform.
- *
+ *
* @param data the char array to write, do not modify during output,
* null ignored
* @param output the <code>Writer</code> to write to
@@ -1427,7 +1427,7 @@ public class IOUtils {
* <p>
* This method uses {@link String#String(char[])} and
* {@link String#getBytes()}.
- *
+ *
* @param data the char array to write, do not modify during output,
* null ignored
* @param output the <code>OutputStream</code> to write to
@@ -1448,7 +1448,7 @@ public class IOUtils {
* <p>
* This method uses {@link String#String(char[])} and
* {@link String#getBytes(String)}.
- *
+ *
* @param data the char array to write, do not modify during output,
* null ignored
* @param output the <code>OutputStream</code> to write to
@@ -1472,7 +1472,7 @@ public class IOUtils {
* <p>
* This method uses {@link String#String(char[])} and
* {@link String#getBytes(String)}.
- *
+ *
* @param data the char array to write, do not modify during output,
* null ignored
* @param output the <code>OutputStream</code> to write to
@@ -1493,7 +1493,7 @@ public class IOUtils {
//-----------------------------------------------------------------------
/**
* Writes chars from a <code>CharSequence</code> to a <code>Writer</code>.
- *
+ *
* @param data the <code>CharSequence</code> to write, null ignored
* @param output the <code>Writer</code> to write to
* @throws NullPointerException if output is null
@@ -1512,7 +1512,7 @@ public class IOUtils {
* platform.
* <p>
* This method uses {@link String#getBytes()}.
- *
+ *
* @param data the <code>CharSequence</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @throws NullPointerException if output is null
@@ -1531,7 +1531,7 @@ public class IOUtils {
* <code>OutputStream</code> using the specified character encoding.
* <p>
* This method uses {@link String#getBytes(String)}.
- *
+ *
* @param data the <code>CharSequence</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
@@ -1553,7 +1553,7 @@ public class IOUtils {
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#getBytes(String)}.
- *
+ *
* @param data the <code>CharSequence</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
@@ -1572,7 +1572,7 @@ public class IOUtils {
//-----------------------------------------------------------------------
/**
* Writes chars from a <code>String</code> to a <code>Writer</code>.
- *
+ *
* @param data the <code>String</code> to write, null ignored
* @param output the <code>Writer</code> to write to
* @throws NullPointerException if output is null
@@ -1591,7 +1591,7 @@ public class IOUtils {
* platform.
* <p>
* This method uses {@link String#getBytes()}.
- *
+ *
* @param data the <code>String</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @throws NullPointerException if output is null
@@ -1610,7 +1610,7 @@ public class IOUtils {
* <code>OutputStream</code> using the specified character encoding.
* <p>
* This method uses {@link String#getBytes(String)}.
- *
+ *
* @param data the <code>String</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
@@ -1632,7 +1632,7 @@ public class IOUtils {
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#getBytes(String)}.
- *
+ *
* @param data the <code>String</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
@@ -1652,7 +1652,7 @@ public class IOUtils {
//-----------------------------------------------------------------------
/**
* Writes chars from a <code>StringBuffer</code> to a <code>Writer</code>.
- *
+ *
* @param data the <code>StringBuffer</code> to write, null ignored
* @param output the <code>Writer</code> to write to
* @throws NullPointerException if output is null
@@ -1674,7 +1674,7 @@ public class IOUtils {
* platform.
* <p>
* This method uses {@link String#getBytes()}.
- *
+ *
* @param data the <code>StringBuffer</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @throws NullPointerException if output is null
@@ -1696,7 +1696,7 @@ public class IOUtils {
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
* <p>
* This method uses {@link String#getBytes(String)}.
- *
+ *
* @param data the <code>StringBuffer</code> to write, null ignored
* @param output the <code>OutputStream</code> to write to
* @param encoding the encoding to use, null means platform default
@@ -1830,7 +1830,7 @@ public class IOUtils {
* <code>-1</code> after the copy has completed since the correct
* number of bytes cannot be returned as an int. For large streams
* use the <code>copyLarge(InputStream, OutputStream)</code> method.
- *
+ *
* @param input the <code>InputStream</code> to read from
* @param output the <code>OutputStream</code> to write to
* @return the number of bytes copied, or -1 if > Integer.MAX_VALUE
@@ -1852,7 +1852,7 @@ public class IOUtils {
* <p>
* This method buffers the input internally, so there is no need to use a <code>BufferedInputStream</code>.
* <p>
- *
+ *
* @param input
* the <code>InputStream</code> to read from
* @param output
@@ -1878,7 +1878,7 @@ public class IOUtils {
* <code>BufferedInputStream</code>.
* <p>
* The buffer size is given by {@link #DEFAULT_BUFFER_SIZE}.
- *
+ *
* @param input the <code>InputStream</code> to read from
* @param output the <code>OutputStream</code> to write to
* @return the number of bytes copied
@@ -1898,7 +1898,7 @@ public class IOUtils {
* This method uses the provided buffer, so there is no need to use a
* <code>BufferedInputStream</code>.
* <p>
- *
+ *
* @param input the <code>InputStream</code> to read from
* @param output the <code>OutputStream</code> to write to
* @param buffer the buffer to use for the copy
@@ -1931,7 +1931,7 @@ public class IOUtils {
* this is done to guarantee that the correct number of characters are skipped.
* </p>
* The buffer size is given by {@link #DEFAULT_BUFFER_SIZE}.
- *
+ *
* @param input the <code>InputStream</code> to read from
* @param output the <code>OutputStream</code> to write to
* @param inputOffset : number of bytes to skip from input before copying
@@ -1959,7 +1959,7 @@ public class IOUtils {
* This means that the method may be considerably less efficient than using the actual skip implementation,
* this is done to guarantee that the correct number of characters are skipped.
* </p>
- *
+ *
* @param input the <code>InputStream</code> to read from
* @param output the <code>OutputStream</code> to write to
* @param inputOffset : number of bytes to skip from input before copying
@@ -1972,7 +1972,7 @@ public class IOUtils {
* @throws IOException if an I/O error occurs
* @since 2.2
*/
- public static long copyLarge(final InputStream input, final OutputStream output,
+ public static long copyLarge(final InputStream input, final OutputStream output,
final long inputOffset, final long length, final byte[] buffer) throws IOException {
if (inputOffset > 0) {
skipFully(input, inputOffset);
@@ -2147,7 +2147,7 @@ public class IOUtils {
* <code>BufferedReader</code>.
* <p>
* The buffer size is given by {@link #DEFAULT_BUFFER_SIZE}.
- *
+ *
* @param input the <code>Reader</code> to read from
* @param output the <code>Writer</code> to write to
* @param inputOffset : number of chars to skip from input before copying
@@ -2170,7 +2170,7 @@ public class IOUtils {
* This method uses the provided buffer, so there is no need to use a
* <code>BufferedReader</code>.
* <p>
- *
+ *
* @param input the <code>Reader</code> to read from
* @param output the <code>Writer</code> to write to
* @param inputOffset : number of chars to skip from input before copying
@@ -2415,14 +2415,14 @@ public class IOUtils {
* this is done to guarantee that the correct number of bytes are skipped.
* </p>
*
- *
+ *
* @param input byte stream to skip
* @param toSkip number of bytes to skip.
* @return number of bytes actually skipped.
- *
+ *
* @see InputStream#skip(long)
* @see <a href="https://issues.apache.org/jira/browse/IO-203">IO-203 - Add skipFully() method for InputStreams</a>
- *
+ *
* @throws IOException if there is a problem reading the file
* @throws IllegalArgumentException if toSkip is negative
* @since 2.0
@@ -2497,10 +2497,10 @@ public class IOUtils {
* @param input character stream to skip
* @param toSkip number of characters to skip.
* @return number of characters actually skipped.
- *
+ *
* @see Reader#skip(long)
* @see <a href="https://issues.apache.org/jira/browse/IO-203">IO-203 - Add skipFully() method for InputStreams</a>
- *
+ *
* @throws IOException if there is a problem reading the file
* @throws IllegalArgumentException if toSkip is negative
* @since 2.0
@@ -2539,14 +2539,14 @@ public class IOUtils {
* This means that the method may be considerably less efficient than using the actual skip implementation,
* this is done to guarantee that the correct number of characters are skipped.
* </p>
- *
+ *
* @param input stream to skip
* @param toSkip the number of bytes to skip
* @see InputStream#skip(long)
- *
+ *
* @throws IOException if there is a problem reading the file
* @throws IllegalArgumentException if toSkip is negative
- * @throws EOFException if the number of bytes skipped was incorrect
+ * @throws EOFException if the number of bytes skipped was incorrect
* @since 2.0
*/
public static void skipFully(final InputStream input, final long toSkip) throws IOException {
@@ -2590,11 +2590,11 @@ public class IOUtils {
* This means that the method may be considerably less efficient than using the actual skip implementation,
* this is done to guarantee that the correct number of characters are skipped.
* </p>
- *
+ *
* @param input stream to skip
* @param toSkip the number of characters to skip
* @see Reader#skip(long)
- *
+ *
* @throws IOException if there is a problem reading the file
* @throws IllegalArgumentException if toSkip is negative
* @throws EOFException if the number of characters skipped was incorrect
@@ -2606,14 +2606,14 @@ public class IOUtils {
throw new EOFException("Chars to skip: " + toSkip + " actual: " + skipped);
}
}
-
+
/**
* Reads characters from an input character stream.
* This implementation guarantees that it will read as many characters
* as possible before giving up; this may not always be the case for
* subclasses of {@link Reader}.
- *
+ *
* @param input where to read input from
* @param buffer destination
* @param offset initial offset into buffer
@@ -2643,7 +2643,7 @@ public class IOUtils {
* This implementation guarantees that it will read as many characters
* as possible before giving up; this may not always be the case for
* subclasses of {@link Reader}.
- *
+ *
* @param input where to read input from
* @param buffer destination
* @return actual length read; may be less than requested if EOF was reached
@@ -2659,7 +2659,7 @@ public class IOUtils {
* This implementation guarantees that it will read as many bytes
* as possible before giving up; this may not always be the case for
* subclasses of {@link InputStream}.
- *
+ *
* @param input where to read input from
* @param buffer destination
* @param offset initial offset into buffer
@@ -2683,13 +2683,13 @@ public class IOUtils {
}
return length - remaining;
}
-
+
/**
* Reads bytes from an input stream.
* This implementation guarantees that it will read as many bytes
* as possible before giving up; this may not always be the case for
* subclasses of {@link InputStream}.
- *
+ *
* @param input where to read input from
* @param buffer destination
* @return actual length read; may be less than requested if EOF was reached
@@ -2729,12 +2729,12 @@ public class IOUtils {
* <p>
* This allows for the possibility that {@link Reader#read(char[], int, int)} may
* not read as many characters as requested (most likely because of reaching EOF).
- *
+ *
* @param input where to read input from
* @param buffer destination
* @param offset initial offset into buffer
* @param length length to read, must be >= 0
- *
+ *
* @throws IOException if there is a problem reading the file
* @throws IllegalArgumentException if length is negative
* @throws EOFException if the number of characters read was incorrect
@@ -2752,10 +2752,10 @@ public class IOUtils {
* <p>
* This allows for the possibility that {@link Reader#read(char[], int, int)} may
* not read as many characters as requested (most likely because of reaching EOF).
- *
+ *
* @param input where to read input from
* @param buffer destination
- *
+ *
* @throws IOException if there is a problem reading the file
* @throws IllegalArgumentException if length is negative
* @throws EOFException if the number of characters read was incorrect
@@ -2770,12 +2770,12 @@ public class IOUtils {
* <p>
* This allows for the possibility that {@link InputStream#read(byte[], int, int)} may
* not read as many bytes as requested (most likely because of reaching EOF).
- *
+ *
* @param input where to read input from
* @param buffer destination
* @param offset initial offset into buffer
* @param length length to read, must be >= 0
- *
+ *
* @throws IOException if there is a problem reading the file
* @throws IllegalArgumentException if length is negative
* @throws EOFException if the number of bytes read was incorrect
@@ -2793,10 +2793,10 @@ public class IOUtils {
* <p>
* This allows for the possibility that {@link InputStream#read(byte[], int, int)} may
* not read as many bytes as requested (most likely because of reaching EOF).
- *
+ *
* @param input where to read input from
* @param buffer destination
- *
+ *
* @throws IOException if there is a problem reading the file
* @throws IllegalArgumentException if length is negative
* @throws EOFException if the number of bytes read was incorrect
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/LineIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/LineIterator.java?rev=1471767&r1=1471766&r2=1471767&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/LineIterator.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/LineIterator.java Wed Apr 24 23:24:19 2013
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -50,7 +50,7 @@ import java.util.NoSuchElementException;
public class LineIterator implements Iterator<String> {
// N.B. This class deliberately does not implement Iterable, see https://issues.apache.org/jira/browse/IO-181
-
+
/** The reader that is being read. */
private final BufferedReader bufferedReader;
/** The current line. */
@@ -140,7 +140,7 @@ public class LineIterator implements Ite
}
final String currentLine = cachedLine;
cachedLine = null;
- return currentLine;
+ return currentLine;
}
/**
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/CanReadFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/CanReadFileFilter.java?rev=1471767&r1=1471766&r2=1471767&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/CanReadFileFilter.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/CanReadFileFilter.java Wed Apr 24 23:24:19 2013
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,7 @@ import java.io.Serializable;
/**
* This filter accepts <code>File</code>s that can be read.
* <p>
- * Example, showing how to print out a list of the
+ * Example, showing how to print out a list of the
* current directory's <i>readable</i> files:
*
* <pre>
@@ -34,7 +34,7 @@ import java.io.Serializable;
* </pre>
*
* <p>
- * Example, showing how to print out a list of the
+ * Example, showing how to print out a list of the
* current directory's <i>un-readable</i> files:
*
* <pre>
@@ -46,7 +46,7 @@ import java.io.Serializable;
* </pre>
*
* <p>
- * Example, showing how to print out a list of the
+ * Example, showing how to print out a list of the
* current directory's <i>read-only</i> files:
*
* <pre>
@@ -61,26 +61,26 @@ import java.io.Serializable;
* @version $Id$
*/
public class CanReadFileFilter extends AbstractFileFilter implements Serializable {
-
+
/** Singleton instance of <i>readable</i> filter */
public static final IOFileFilter CAN_READ = new CanReadFileFilter();
/** Singleton instance of not <i>readable</i> filter */
public static final IOFileFilter CANNOT_READ = new NotFileFilter(CAN_READ);
-
+
/** Singleton instance of <i>read-only</i> filter */
public static final IOFileFilter READ_ONLY = new AndFileFilter(CAN_READ,
CanWriteFileFilter.CANNOT_WRITE);
-
+
/**
* Restrictive consructor.
*/
protected CanReadFileFilter() {
}
-
+
/**
* Checks to see if the file can be read.
- *
+ *
* @param file the File to check.
* @return {@code true} if the file can be
* read, otherwise {@code false}.
@@ -89,5 +89,5 @@ public class CanReadFileFilter extends A
public boolean accept(final File file) {
return file.canRead();
}
-
+
}
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/CanWriteFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/CanWriteFileFilter.java?rev=1471767&r1=1471766&r2=1471767&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/CanWriteFileFilter.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/CanWriteFileFilter.java Wed Apr 24 23:24:19 2013
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -46,14 +46,14 @@ import java.io.Serializable;
* </pre>
*
* <p>
- * <b>N.B.</b> For read-only files, use
+ * <b>N.B.</b> For read-only files, use
* <code>CanReadFileFilter.READ_ONLY</code>.
*
* @since 1.3
* @version $Id$
*/
public class CanWriteFileFilter extends AbstractFileFilter implements Serializable {
-
+
/** Singleton instance of <i>writable</i> filter */
public static final IOFileFilter CAN_WRITE = new CanWriteFileFilter();
@@ -65,10 +65,10 @@ public class CanWriteFileFilter extends
*/
protected CanWriteFileFilter() {
}
-
+
/**
* Checks to see if the file can be written to.
- *
+ *
* @param file the File to check
* @return {@code true} if the file can be
* written to, otherwise {@code false}.
@@ -77,5 +77,5 @@ public class CanWriteFileFilter extends
public boolean accept(final File file) {
return file.canWrite();
}
-
+
}
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/DelegateFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/DelegateFileFilter.java?rev=1471767&r1=1471766&r2=1471767&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/DelegateFileFilter.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/DelegateFileFilter.java Wed Apr 24 23:24:19 2013
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,10 +23,10 @@ import java.io.Serializable;
/**
* This class turns a Java FileFilter or FilenameFilter into an IO FileFilter.
- *
+ *
* @since 1.0
* @version $Id$
- *
+ *
* @see FileFilterUtils#asFileFilter(FileFilter)
* @see FileFilterUtils#asFileFilter(FilenameFilter)
*/
@@ -39,7 +39,7 @@ public class DelegateFileFilter extends
/**
* Constructs a delegate file filter around an existing FilenameFilter.
- *
+ *
* @param filter the filter to decorate
*/
public DelegateFileFilter(final FilenameFilter filter) {
@@ -52,7 +52,7 @@ public class DelegateFileFilter extends
/**
* Constructs a delegate file filter around an existing FileFilter.
- *
+ *
* @param filter the filter to decorate
*/
public DelegateFileFilter(final FileFilter filter) {
@@ -65,7 +65,7 @@ public class DelegateFileFilter extends
/**
* Checks the filter.
- *
+ *
* @param file the file to check
* @return true if the filter matches
*/
@@ -80,7 +80,7 @@ public class DelegateFileFilter extends
/**
* Checks the filter.
- *
+ *
* @param dir the directory
* @param name the filename in the directory
* @return true if the filter matches
@@ -101,8 +101,8 @@ public class DelegateFileFilter extends
*/
@Override
public String toString() {
- final String delegate = fileFilter != null ? fileFilter.toString() : filenameFilter.toString();
+ final String delegate = fileFilter != null ? fileFilter.toString() : filenameFilter.toString();
return super.toString() + "(" + delegate + ")";
}
-
+
}
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/EmptyFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/EmptyFileFilter.java?rev=1471767&r1=1471766&r2=1471767&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/EmptyFileFilter.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/EmptyFileFilter.java Wed Apr 24 23:24:19 2013
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,7 @@ import java.io.Serializable;
* If the <code>File</code> is a directory it checks that
* it contains no files.
* <p>
- * Example, showing how to print out a list of the
+ * Example, showing how to print out a list of the
* current directory's empty files/directories:
*
* <pre>
@@ -37,7 +37,7 @@ import java.io.Serializable;
* </pre>
*
* <p>
- * Example, showing how to print out a list of the
+ * Example, showing how to print out a list of the
* current directory's non-empty files/directories:
*
* <pre>
@@ -52,22 +52,22 @@ import java.io.Serializable;
* @version $Id$
*/
public class EmptyFileFilter extends AbstractFileFilter implements Serializable {
-
+
/** Singleton instance of <i>empty</i> filter */
public static final IOFileFilter EMPTY = new EmptyFileFilter();
-
+
/** Singleton instance of <i>not-empty</i> filter */
public static final IOFileFilter NOT_EMPTY = new NotFileFilter(EMPTY);
-
+
/**
* Restrictive consructor.
*/
protected EmptyFileFilter() {
}
-
+
/**
* Checks to see if the file is empty.
- *
+ *
* @param file the file or directory to check
* @return {@code true} if the file or directory
* is <i>empty</i>, otherwise {@code false}.
@@ -81,5 +81,5 @@ public class EmptyFileFilter extends Abs
return file.length() == 0;
}
}
-
+
}
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/FileFilterUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/FileFilterUtils.java?rev=1471767&r1=1471766&r2=1471767&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/FileFilterUtils.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/FileFilterUtils.java Wed Apr 24 23:24:19 2013
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,12 +33,12 @@ import org.apache.commons.io.IOCase;
* Useful utilities for working with file filters. It provides access to all
* file filter implementations in this package so you don't have to import
* every class you use.
- *
+ *
* @since 1.0
* @version $Id$
*/
public class FileFilterUtils {
-
+
/**
* FileFilterUtils is not normally instantiated.
*/
@@ -49,15 +49,15 @@ public class FileFilterUtils {
/**
* <p>
- * Applies an {@link IOFileFilter} to the provided {@link File}
- * objects. The resulting array is a subset of the original file list that
+ * Applies an {@link IOFileFilter} to the provided {@link File}
+ * objects. The resulting array is a subset of the original file list that
* matches the provided filter.
* </p>
- *
+ *
* <p>
* The {@link Set} returned by this method is not guaranteed to be thread safe.
* </p>
- *
+ *
* <pre>
* Set<File> allFiles = ...
* Set<File> javaFiles = FileFilterUtils.filterSet(allFiles,
@@ -65,12 +65,12 @@ public class FileFilterUtils {
* </pre>
* @param filter the filter to apply to the set of files.
* @param files the array of files to apply the filter to.
- *
- * @return a subset of <code>files</code> that is accepted by the
+ *
+ * @return a subset of <code>files</code> that is accepted by the
* file filter.
- * @throws IllegalArgumentException if the filter is {@code null}
- * or <code>files</code> contains a {@code null} value.
- *
+ * @throws IllegalArgumentException if the filter is {@code null}
+ * or <code>files</code> contains a {@code null} value.
+ *
* @since 2.0
*/
public static File[] filter(final IOFileFilter filter, final File... files) {
@@ -94,15 +94,15 @@ public class FileFilterUtils {
/**
* <p>
- * Applies an {@link IOFileFilter} to the provided {@link File}
- * objects. The resulting array is a subset of the original file list that
+ * Applies an {@link IOFileFilter} to the provided {@link File}
+ * objects. The resulting array is a subset of the original file list that
* matches the provided filter.
* </p>
- *
+ *
* <p>
* The {@link Set} returned by this method is not guaranteed to be thread safe.
* </p>
- *
+ *
* <pre>
* Set<File> allFiles = ...
* Set<File> javaFiles = FileFilterUtils.filterSet(allFiles,
@@ -110,12 +110,12 @@ public class FileFilterUtils {
* </pre>
* @param filter the filter to apply to the set of files.
* @param files the array of files to apply the filter to.
- *
- * @return a subset of <code>files</code> that is accepted by the
+ *
+ * @return a subset of <code>files</code> that is accepted by the
* file filter.
- * @throws IllegalArgumentException if the filter is {@code null}
- * or <code>files</code> contains a {@code null} value.
- *
+ * @throws IllegalArgumentException if the filter is {@code null}
+ * or <code>files</code> contains a {@code null} value.
+ *
* @since 2.0
*/
public static File[] filter(final IOFileFilter filter, final Iterable<File> files) {
@@ -125,15 +125,15 @@ public class FileFilterUtils {
/**
* <p>
- * Applies an {@link IOFileFilter} to the provided {@link File}
- * objects. The resulting list is a subset of the original files that
+ * Applies an {@link IOFileFilter} to the provided {@link File}
+ * objects. The resulting list is a subset of the original files that
* matches the provided filter.
* </p>
- *
+ *
* <p>
* The {@link List} returned by this method is not guaranteed to be thread safe.
* </p>
- *
+ *
* <pre>
* List<File> filesAndDirectories = ...
* List<File> directories = FileFilterUtils.filterList(filesAndDirectories,
@@ -141,11 +141,11 @@ public class FileFilterUtils {
* </pre>
* @param filter the filter to apply to each files in the list.
* @param files the collection of files to apply the filter to.
- *
- * @return a subset of <code>files</code> that is accepted by the
+ *
+ * @return a subset of <code>files</code> that is accepted by the
* file filter.
- * @throws IllegalArgumentException if the filter is {@code null}
- * or <code>files</code> contains a {@code null} value.
+ * @throws IllegalArgumentException if the filter is {@code null}
+ * or <code>files</code> contains a {@code null} value.
* @since 2.0
*/
public static List<File> filterList(final IOFileFilter filter, final Iterable<File> files) {
@@ -154,15 +154,15 @@ public class FileFilterUtils {
/**
* <p>
- * Applies an {@link IOFileFilter} to the provided {@link File}
- * objects. The resulting list is a subset of the original files that
+ * Applies an {@link IOFileFilter} to the provided {@link File}
+ * objects. The resulting list is a subset of the original files that
* matches the provided filter.
* </p>
- *
+ *
* <p>
* The {@link List} returned by this method is not guaranteed to be thread safe.
* </p>
- *
+ *
* <pre>
* List<File> filesAndDirectories = ...
* List<File> directories = FileFilterUtils.filterList(filesAndDirectories,
@@ -170,11 +170,11 @@ public class FileFilterUtils {
* </pre>
* @param filter the filter to apply to each files in the list.
* @param files the collection of files to apply the filter to.
- *
- * @return a subset of <code>files</code> that is accepted by the
+ *
+ * @return a subset of <code>files</code> that is accepted by the
* file filter.
- * @throws IllegalArgumentException if the filter is {@code null}
- * or <code>files</code> contains a {@code null} value.
+ * @throws IllegalArgumentException if the filter is {@code null}
+ * or <code>files</code> contains a {@code null} value.
* @since 2.0
*/
public static List<File> filterList(final IOFileFilter filter, final File... files) {
@@ -184,15 +184,15 @@ public class FileFilterUtils {
/**
* <p>
- * Applies an {@link IOFileFilter} to the provided {@link File}
- * objects. The resulting set is a subset of the original file list that
+ * Applies an {@link IOFileFilter} to the provided {@link File}
+ * objects. The resulting set is a subset of the original file list that
* matches the provided filter.
* </p>
- *
+ *
* <p>
* The {@link Set} returned by this method is not guaranteed to be thread safe.
* </p>
- *
+ *
* <pre>
* Set<File> allFiles = ...
* Set<File> javaFiles = FileFilterUtils.filterSet(allFiles,
@@ -200,12 +200,12 @@ public class FileFilterUtils {
* </pre>
* @param filter the filter to apply to the set of files.
* @param files the collection of files to apply the filter to.
- *
- * @return a subset of <code>files</code> that is accepted by the
+ *
+ * @return a subset of <code>files</code> that is accepted by the
* file filter.
- * @throws IllegalArgumentException if the filter is {@code null}
- * or <code>files</code> contains a {@code null} value.
- *
+ * @throws IllegalArgumentException if the filter is {@code null}
+ * or <code>files</code> contains a {@code null} value.
+ *
* @since 2.0
*/
public static Set<File> filterSet(final IOFileFilter filter, final File... files) {
@@ -215,15 +215,15 @@ public class FileFilterUtils {
/**
* <p>
- * Applies an {@link IOFileFilter} to the provided {@link File}
- * objects. The resulting set is a subset of the original file list that
+ * Applies an {@link IOFileFilter} to the provided {@link File}
+ * objects. The resulting set is a subset of the original file list that
* matches the provided filter.
* </p>
- *
+ *
* <p>
* The {@link Set} returned by this method is not guaranteed to be thread safe.
* </p>
- *
+ *
* <pre>
* Set<File> allFiles = ...
* Set<File> javaFiles = FileFilterUtils.filterSet(allFiles,
@@ -231,12 +231,12 @@ public class FileFilterUtils {
* </pre>
* @param filter the filter to apply to the set of files.
* @param files the collection of files to apply the filter to.
- *
- * @return a subset of <code>files</code> that is accepted by the
+ *
+ * @return a subset of <code>files</code> that is accepted by the
* file filter.
- * @throws IllegalArgumentException if the filter is {@code null}
- * or <code>files</code> contains a {@code null} value.
- *
+ * @throws IllegalArgumentException if the filter is {@code null}
+ * or <code>files</code> contains a {@code null} value.
+ *
* @since 2.0
*/
public static Set<File> filterSet(final IOFileFilter filter, final Iterable<File> files) {
@@ -245,25 +245,25 @@ public class FileFilterUtils {
/**
* <p>
- * Applies an {@link IOFileFilter} to the provided {@link File}
- * objects and appends the accepted files to the other supplied collection.
+ * Applies an {@link IOFileFilter} to the provided {@link File}
+ * objects and appends the accepted files to the other supplied collection.
* </p>
- *
+ *
* <pre>
* List<File> files = ...
* List<File> directories = FileFilterUtils.filterList(files,
- * FileFilterUtils.sizeFileFilter(FileUtils.FIFTY_MB),
+ * FileFilterUtils.sizeFileFilter(FileUtils.FIFTY_MB),
* new ArrayList<File>());
* </pre>
* @param filter the filter to apply to the collection of files.
* @param files the collection of files to apply the filter to.
* @param acceptedFiles the list of files to add accepted files to.
- *
+ *
* @param <T> the type of the file collection.
- * @return a subset of <code>files</code> that is accepted by the
+ * @return a subset of <code>files</code> that is accepted by the
* file filter.
- * @throws IllegalArgumentException if the filter is {@code null}
- * or <code>files</code> contains a {@code null} value.
+ * @throws IllegalArgumentException if the filter is {@code null}
+ * or <code>files</code> contains a {@code null} value.
*/
private static <T extends Collection<File>> T filter(final IOFileFilter filter,
final Iterable<File> files, final T acceptedFiles) {
@@ -285,7 +285,7 @@ public class FileFilterUtils {
/**
* Returns a filter that returns true if the filename starts with the specified text.
- *
+ *
* @param prefix the filename prefix
* @return a prefix checking filter
* @see PrefixFileFilter
@@ -296,7 +296,7 @@ public class FileFilterUtils {
/**
* Returns a filter that returns true if the filename starts with the specified text.
- *
+ *
* @param prefix the filename prefix
* @param caseSensitivity how to handle case sensitivity, null means case-sensitive
* @return a prefix checking filter
@@ -309,7 +309,7 @@ public class FileFilterUtils {
/**
* Returns a filter that returns true if the filename ends with the specified text.
- *
+ *
* @param suffix the filename suffix
* @return a suffix checking filter
* @see SuffixFileFilter
@@ -320,7 +320,7 @@ public class FileFilterUtils {
/**
* Returns a filter that returns true if the filename ends with the specified text.
- *
+ *
* @param suffix the filename suffix
* @param caseSensitivity how to handle case sensitivity, null means case-sensitive
* @return a suffix checking filter
@@ -333,7 +333,7 @@ public class FileFilterUtils {
/**
* Returns a filter that returns true if the filename matches the specified text.
- *
+ *
* @param name the filename
* @return a name checking filter
* @see NameFileFilter
@@ -344,7 +344,7 @@ public class FileFilterUtils {
/**
* Returns a filter that returns true if the filename matches the specified text.
- *
+ *
* @param name the filename
* @param caseSensitivity how to handle case sensitivity, null means case-sensitive
* @return a name checking filter
@@ -357,7 +357,7 @@ public class FileFilterUtils {
/**
* Returns a filter that checks if the file is a directory.
- *
+ *
* @return file filter that accepts only directories and not files
* @see DirectoryFileFilter#DIRECTORY
*/
@@ -367,7 +367,7 @@ public class FileFilterUtils {
/**
* Returns a filter that checks if the file is a file (and not a directory).
- *
+ *
* @return file filter that accepts only files and not directories
* @see FileFileFilter#FILE
*/
@@ -378,7 +378,7 @@ public class FileFilterUtils {
//-----------------------------------------------------------------------
/**
* Returns a filter that ANDs the two specified filters.
- *
+ *
* @param filter1 the first filter
* @param filter2 the second filter
* @return a filter that ANDs the two specified filters
@@ -393,7 +393,7 @@ public class FileFilterUtils {
/**
* Returns a filter that ORs the two specified filters.
- *
+ *
* @param filter1 the first filter
* @param filter2 the second filter
* @return a filter that ORs the two specified filters
@@ -408,11 +408,11 @@ public class FileFilterUtils {
/**
* Returns a filter that ANDs the specified filters.
- *
+ *
* @param filters the IOFileFilters that will be ANDed together.
* @return a filter that ANDs the specified filters
- *
- * @throws IllegalArgumentException if the filters are null or contain a
+ *
+ * @throws IllegalArgumentException if the filters are null or contain a
* null value.
* @see AndFileFilter
* @since 2.0
@@ -423,11 +423,11 @@ public class FileFilterUtils {
/**
* Returns a filter that ORs the specified filters.
- *
+ *
* @param filters the IOFileFilters that will be ORed together.
* @return a filter that ORs the specified filters
- *
- * @throws IllegalArgumentException if the filters are null or contain a
+ *
+ * @throws IllegalArgumentException if the filters are null or contain a
* null value.
* @see OrFileFilter
* @since 2.0
@@ -441,7 +441,7 @@ public class FileFilterUtils {
*
* @param filters The file filters
* @return The list of file filters
- * @throws IllegalArgumentException if the filters are null or contain a
+ * @throws IllegalArgumentException if the filters are null or contain a
* null value.
* @since 2.0
*/
@@ -461,7 +461,7 @@ public class FileFilterUtils {
/**
* Returns a filter that NOTs the specified filter.
- *
+ *
* @param filter the filter to invert
* @return a filter that NOTs the specified filter
* @see NotFileFilter
@@ -473,7 +473,7 @@ public class FileFilterUtils {
//-----------------------------------------------------------------------
/**
* Returns a filter that always returns true.
- *
+ *
* @return a true filter
* @see TrueFileFilter#TRUE
*/
@@ -483,19 +483,19 @@ public class FileFilterUtils {
/**
* Returns a filter that always returns false.
- *
+ *
* @return a false filter
* @see FalseFileFilter#FALSE
*/
public static IOFileFilter falseFileFilter() {
return FalseFileFilter.FALSE;
}
-
+
//-----------------------------------------------------------------------
/**
* Returns an <code>IOFileFilter</code> that wraps the
* <code>FileFilter</code> instance.
- *
+ *
* @param filter the filter to be wrapped
* @return a new filter that implements IOFileFilter
* @see DelegateFileFilter
@@ -507,7 +507,7 @@ public class FileFilterUtils {
/**
* Returns an <code>IOFileFilter</code> that wraps the
* <code>FilenameFilter</code> instance.
- *
+ *
* @param filter the filter to be wrapped
* @return a new filter that implements IOFileFilter
* @see DelegateFileFilter
@@ -638,18 +638,18 @@ public class FileFilterUtils {
final IOFileFilter maximumFilter = new SizeFileFilter(maxSizeInclusive + 1L, false);
return new AndFileFilter(minimumFilter, maximumFilter);
}
-
+
/**
* Returns a filter that accepts files that begin with the provided magic
* number.
- *
- * @param magicNumber the magic number (byte sequence) to match at the
+ *
+ * @param magicNumber the magic number (byte sequence) to match at the
* beginning of each file.
- *
+ *
* @return an IOFileFilter that accepts files beginning with the provided
* magic number.
- *
- * @throws IllegalArgumentException if <code>magicNumber</code> is
+ *
+ * @throws IllegalArgumentException if <code>magicNumber</code> is
* {@code null} or the empty String.
* @see MagicNumberFileFilter
* @since 2.0
@@ -657,20 +657,20 @@ public class FileFilterUtils {
public static IOFileFilter magicNumberFileFilter(final String magicNumber) {
return new MagicNumberFileFilter(magicNumber);
}
-
+
/**
* Returns a filter that accepts files that contains the provided magic
* number at a specified offset within the file.
- *
- * @param magicNumber the magic number (byte sequence) to match at the
+ *
+ * @param magicNumber the magic number (byte sequence) to match at the
* provided offset in each file.
* @param offset the offset within the files to look for the magic number.
- *
+ *
* @return an IOFileFilter that accepts files containing the magic number
* at the specified offset.
- *
- * @throws IllegalArgumentException if <code>magicNumber</code> is
- * {@code null} or the empty String, or if offset is a
+ *
+ * @throws IllegalArgumentException if <code>magicNumber</code> is
+ * {@code null} or the empty String, or if offset is a
* negative number.
* @see MagicNumberFileFilter
* @since 2.0
@@ -678,18 +678,18 @@ public class FileFilterUtils {
public static IOFileFilter magicNumberFileFilter(final String magicNumber, final long offset) {
return new MagicNumberFileFilter(magicNumber, offset);
}
-
+
/**
* Returns a filter that accepts files that begin with the provided magic
* number.
- *
- * @param magicNumber the magic number (byte sequence) to match at the
+ *
+ * @param magicNumber the magic number (byte sequence) to match at the
* beginning of each file.
- *
+ *
* @return an IOFileFilter that accepts files beginning with the provided
* magic number.
- *
- * @throws IllegalArgumentException if <code>magicNumber</code> is
+ *
+ * @throws IllegalArgumentException if <code>magicNumber</code> is
* {@code null} or is of length zero.
* @see MagicNumberFileFilter
* @since 2.0
@@ -697,20 +697,20 @@ public class FileFilterUtils {
public static IOFileFilter magicNumberFileFilter(final byte[] magicNumber) {
return new MagicNumberFileFilter(magicNumber);
}
-
+
/**
* Returns a filter that accepts files that contains the provided magic
* number at a specified offset within the file.
- *
- * @param magicNumber the magic number (byte sequence) to match at the
+ *
+ * @param magicNumber the magic number (byte sequence) to match at the
* provided offset in each file.
* @param offset the offset within the files to look for the magic number.
- *
+ *
* @return an IOFileFilter that accepts files containing the magic number
* at the specified offset.
- *
- * @throws IllegalArgumentException if <code>magicNumber</code> is
- * {@code null}, or contains no bytes, or <code>offset</code>
+ *
+ * @throws IllegalArgumentException if <code>magicNumber</code> is
+ * {@code null}, or contains no bytes, or <code>offset</code>
* is a negative number.
* @see MagicNumberFileFilter
* @since 2.0
@@ -732,7 +732,7 @@ public class FileFilterUtils {
* Decorates a filter to make it ignore CVS directories.
* Passing in {@code null} will return a filter that accepts everything
* except CVS directories.
- *
+ *
* @param filter the filter to decorate, null means an unrestricted filter
* @return the decorated filter, never null
* @since 1.1 (method existed but had bug in 1.0)
@@ -749,7 +749,7 @@ public class FileFilterUtils {
* Decorates a filter to make it ignore SVN directories.
* Passing in {@code null} will return a filter that accepts everything
* except SVN directories.
- *
+ *
* @param filter the filter to decorate, null means an unrestricted filter
* @return the decorated filter, never null
* @since 1.1
@@ -765,7 +765,7 @@ public class FileFilterUtils {
//-----------------------------------------------------------------------
/**
* Decorates a filter so that it only applies to directories and not to files.
- *
+ *
* @param filter the filter to decorate, null means an unrestricted filter
* @return the decorated filter, never null
* @see DirectoryFileFilter#DIRECTORY
@@ -780,7 +780,7 @@ public class FileFilterUtils {
/**
* Decorates a filter so that it only applies to files and not to directories.
- *
+ *
* @param filter the filter to decorate, null means an unrestricted filter
* @return the decorated filter, never null
* @see FileFileFilter#FILE
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/HiddenFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/HiddenFileFilter.java?rev=1471767&r1=1471766&r2=1471767&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/HiddenFileFilter.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/HiddenFileFilter.java Wed Apr 24 23:24:19 2013
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -49,22 +49,22 @@ import java.io.Serializable;
* @version $Id$
*/
public class HiddenFileFilter extends AbstractFileFilter implements Serializable {
-
+
/** Singleton instance of <i>hidden</i> filter */
public static final IOFileFilter HIDDEN = new HiddenFileFilter();
-
+
/** Singleton instance of <i>visible</i> filter */
public static final IOFileFilter VISIBLE = new NotFileFilter(HIDDEN);
-
+
/**
* Restrictive consructor.
*/
protected HiddenFileFilter() {
}
-
+
/**
* Checks to see if the file is hidden.
- *
+ *
* @param file the File to check
* @return {@code true} if the file is
* <i>hidden</i>, otherwise {@code false}.
@@ -73,5 +73,5 @@ public class HiddenFileFilter extends Ab
public boolean accept(final File file) {
return file.isHidden();
}
-
+
}
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/IOFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/IOFileFilter.java?rev=1471767&r1=1471766&r2=1471767&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/IOFileFilter.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/IOFileFilter.java Wed Apr 24 23:24:19 2013
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,9 +21,9 @@ import java.io.FileFilter;
import java.io.FilenameFilter;
/**
- * An interface which brings the FileFilter and FilenameFilter
+ * An interface which brings the FileFilter and FilenameFilter
* interfaces together.
- *
+ *
* @since 1.0
* @version $Id$
*/
@@ -33,7 +33,7 @@ public interface IOFileFilter extends Fi
* Checks to see if the File should be accepted by this filter.
* <p>
* Defined in {@link java.io.FileFilter}.
- *
+ *
* @param file the File to check
* @return true if this file matches the test
*/
@@ -43,11 +43,11 @@ public interface IOFileFilter extends Fi
* Checks to see if the File should be accepted by this filter.
* <p>
* Defined in {@link java.io.FilenameFilter}.
- *
+ *
* @param dir the directory File to check
* @param name the filename within the directory to check
* @return true if this file matches the test
*/
boolean accept(File dir, String name);
-
+
}
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/MagicNumberFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/MagicNumberFileFilter.java?rev=1471767&r1=1471766&r2=1471767&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/MagicNumberFileFilter.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/MagicNumberFileFilter.java Wed Apr 24 23:24:19 2013
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,33 +27,33 @@ import org.apache.commons.io.IOUtils;
/**
* <p>
- * File filter for matching files containing a "magic number". A magic number
+ * File filter for matching files containing a "magic number". A magic number
* is a unique series of bytes common to all files of a specific file format.
- * For instance, all Java class files begin with the bytes
- * <code>0xCAFEBABE</code>.
+ * For instance, all Java class files begin with the bytes
+ * <code>0xCAFEBABE</code>.
* </p>
- *
+ *
* <code><pre>
* File dir = new File(".");
* MagicNumberFileFilter javaClassFileFilter =
- * MagicNumberFileFilter(new byte[] {(byte) 0xCA, (byte) 0xFE,
- * (byte) 0xBA, (byte) 0xBE});
+ * MagicNumberFileFilter(new byte[] {(byte) 0xCA, (byte) 0xFE,
+ * (byte) 0xBA, (byte) 0xBE});
* String[] javaClassFiles = dir.list(javaClassFileFilter);
* for (String javaClassFile : javaClassFiles) {
* System.out.println(javaClassFile);
* }
* </pre></code>
- *
+ *
* <p>
* Sometimes, such as in the case of TAR files, the
* magic number will be offset by a certain number of bytes in the file. In the
* case of TAR archive files, this offset is 257 bytes.
* </p>
- *
+ *
* <code><pre>
* File dir = new File(".");
- * MagicNumberFileFilter tarFileFilter =
- * MagicNumberFileFilter("ustar", 257);
+ * MagicNumberFileFilter tarFileFilter =
+ * MagicNumberFileFilter("ustar", 257);
* String[] tarFiles = dir.list(tarFileFilter);
* for (String tarFile : tarFiles) {
* System.out.println(tarFile);
@@ -67,95 +67,95 @@ import org.apache.commons.io.IOUtils;
*/
public class MagicNumberFileFilter extends AbstractFileFilter implements
Serializable {
-
+
/**
* The serialization version unique identifier.
*/
private static final long serialVersionUID = -547733176983104172L;
/**
- * The magic number to compare against the file's bytes at the provided
+ * The magic number to compare against the file's bytes at the provided
* offset.
*/
private final byte[] magicNumbers;
-
+
/**
- * The offset (in bytes) within the files that the magic number's bytes
+ * The offset (in bytes) within the files that the magic number's bytes
* should appear.
*/
private final long byteOffset;
-
+
/**
* <p>
* Constructs a new MagicNumberFileFilter and associates it with the magic
* number to test for in files. This constructor assumes a starting offset
* of <code>0</code>.
* </p>
- *
+ *
* <p>
* It is important to note that <em>the array is not cloned</em> and that
* any changes to the magic number array after construction will affect the
* behavior of this file filter.
* </p>
- *
+ *
* <code><pre>
* MagicNumberFileFilter javaClassFileFilter =
- * MagicNumberFileFilter(new byte[] {(byte) 0xCA, (byte) 0xFE,
- * (byte) 0xBA, (byte) 0xBE});
+ * MagicNumberFileFilter(new byte[] {(byte) 0xCA, (byte) 0xFE,
+ * (byte) 0xBA, (byte) 0xBE});
* </pre></code>
- *
+ *
* @param magicNumber the magic number to look for in the file.
- *
- * @throws IllegalArgumentException if <code>magicNumber</code> is
+ *
+ * @throws IllegalArgumentException if <code>magicNumber</code> is
* {@code null}, or contains no bytes.
*/
public MagicNumberFileFilter(final byte[] magicNumber) {
this(magicNumber, 0);
}
-
+
/**
* <p>
* Constructs a new MagicNumberFileFilter and associates it with the magic
* number to test for in files. This constructor assumes a starting offset
* of <code>0</code>.
* </p>
- *
+ *
* Example usage:
* <pre>
* {@code
- * MagicNumberFileFilter xmlFileFilter =
- * MagicNumberFileFilter("<?xml");
+ * MagicNumberFileFilter xmlFileFilter =
+ * MagicNumberFileFilter("<?xml");
* }
* </pre>
- *
+ *
* @param magicNumber the magic number to look for in the file.
* The string is converted to bytes using the platform default charset.
*
- * @throws IllegalArgumentException if <code>magicNumber</code> is
+ * @throws IllegalArgumentException if <code>magicNumber</code> is
* {@code null} or the empty String.
*/
public MagicNumberFileFilter(final String magicNumber) {
this(magicNumber, 0);
}
-
+
/**
* <p>
* Constructs a new MagicNumberFileFilter and associates it with the magic
* number to test for in files and the byte offset location in the file to
* to look for that magic number.
* </p>
- *
+ *
* <code><pre>
- * MagicNumberFileFilter tarFileFilter =
- * MagicNumberFileFilter("ustar", 257);
+ * MagicNumberFileFilter tarFileFilter =
+ * MagicNumberFileFilter("ustar", 257);
* </pre></code>
- *
- * @param magicNumber the magic number to look for in the file.
+ *
+ * @param magicNumber the magic number to look for in the file.
* The string is converted to bytes using the platform default charset.
* @param offset the byte offset in the file to start comparing bytes.
- *
- * @throws IllegalArgumentException if <code>magicNumber</code> is
- * {@code null} or the empty String, or <code>offset</code> is
+ *
+ * @throws IllegalArgumentException if <code>magicNumber</code> is
+ * {@code null} or the empty String, or <code>offset</code> is
* a negative number.
*/
public MagicNumberFileFilter(final String magicNumber, final long offset) {
@@ -168,33 +168,33 @@ public class MagicNumberFileFilter exten
if (offset < 0) {
throw new IllegalArgumentException("The offset cannot be negative");
}
-
+
this.magicNumbers = magicNumber.getBytes(Charset.defaultCharset()); // explicitly uses the platform default charset
this.byteOffset = offset;
}
-
+
/**
* <p>
* Constructs a new MagicNumberFileFilter and associates it with the magic
* number to test for in files and the byte offset location in the file to
* to look for that magic number.
* </p>
- *
+ *
* <code><pre>
* MagicNumberFileFilter tarFileFilter =
- * MagicNumberFileFilter(new byte[] {0x75, 0x73, 0x74, 0x61, 0x72}, 257);
+ * MagicNumberFileFilter(new byte[] {0x75, 0x73, 0x74, 0x61, 0x72}, 257);
* </pre></code>
- *
+ *
* <code><pre>
* MagicNumberFileFilter javaClassFileFilter =
- * MagicNumberFileFilter(new byte[] {0xCA, 0xFE, 0xBA, 0xBE}, 0);
+ * MagicNumberFileFilter(new byte[] {0xCA, 0xFE, 0xBA, 0xBE}, 0);
* </pre></code>
- *
+ *
* @param magicNumber the magic number to look for in the file.
* @param offset the byte offset in the file to start comparing bytes.
- *
- * @throws IllegalArgumentException if <code>magicNumber</code> is
- * {@code null}, or contains no bytes, or <code>offset</code>
+ *
+ * @throws IllegalArgumentException if <code>magicNumber</code> is
+ * {@code null}, or contains no bytes, or <code>offset</code>
* is a negative number.
*/
public MagicNumberFileFilter(final byte[] magicNumber, final long offset) {
@@ -207,26 +207,26 @@ public class MagicNumberFileFilter exten
if (offset < 0) {
throw new IllegalArgumentException("The offset cannot be negative");
}
-
+
this.magicNumbers = new byte[magicNumber.length];
System.arraycopy(magicNumber, 0, this.magicNumbers, 0, magicNumber.length);
this.byteOffset = offset;
}
-
+
/**
* <p>
* Accepts the provided file if the file contains the file filter's magic
* number at the specified offset.
* </p>
- *
+ *
* <p>
* If any {@link IOException}s occur while reading the file, the file will
* be rejected.
* </p>
- *
+ *
* @param file the file to accept or reject.
- *
- * @return {@code true} if the file contains the filter's magic number
+ *
+ * @return {@code true} if the file contains the filter's magic number
* at the specified offset, {@code false} otherwise.
*/
@Override
@@ -234,7 +234,7 @@ public class MagicNumberFileFilter exten
if (file != null && file.isFile() && file.canRead()) {
RandomAccessFile randomAccessFile = null;
try {
- final byte[] fileBytes = new byte[this.magicNumbers.length];
+ final byte[] fileBytes = new byte[this.magicNumbers.length];
randomAccessFile = new RandomAccessFile(file, "r");
randomAccessFile.seek(byteOffset);
final int read = randomAccessFile.read(fileBytes);
@@ -248,14 +248,14 @@ public class MagicNumberFileFilter exten
IOUtils.closeQuietly(randomAccessFile);
}
}
-
+
return false;
}
/**
- * Returns a String representation of the file filter, which includes the
+ * Returns a String representation of the file filter, which includes the
* magic number bytes and byte offset.
- *
+ *
* @return a String representation of the file filter.
*/
@Override
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/NameFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/NameFileFilter.java?rev=1471767&r1=1471766&r2=1471767&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/NameFileFilter.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/NameFileFilter.java Wed Apr 24 23:24:19 2013
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,7 @@ import org.apache.commons.io.IOCase;
/**
* Filters filenames for a certain name.
* <p>
- * For example, to print all files and directories in the
+ * For example, to print all files and directories in the
* current directory whose name is <code>Test</code>:
*
* <pre>
@@ -42,7 +42,7 @@ import org.apache.commons.io.IOCase;
* @see FileFilterUtils#nameFileFilter(String, IOCase)
*/
public class NameFileFilter extends AbstractFileFilter implements Serializable {
-
+
/** The filenames to search for */
private final String[] names;
/** Whether the comparison is case sensitive. */
@@ -50,7 +50,7 @@ public class NameFileFilter extends Abst
/**
* Constructs a new case-sensitive name file filter for a single name.
- *
+ *
* @param name the name to allow, must not be null
* @throws IllegalArgumentException if the name is null
*/
@@ -78,7 +78,7 @@ public class NameFileFilter extends Abst
* <p>
* The array is not cloned, so could be changed after constructing the
* instance. This would be inadvisable however.
- *
+ *
* @param names the names to allow, must not be null
* @throws IllegalArgumentException if the names array is null
*/
@@ -88,7 +88,7 @@ public class NameFileFilter extends Abst
/**
* Constructs a new name file filter for an array of names specifying case-sensitivity.
- *
+ *
* @param names the names to allow, must not be null
* @param caseSensitivity how to handle case sensitivity, null means case-sensitive
* @throws IllegalArgumentException if the names array is null
@@ -104,7 +104,7 @@ public class NameFileFilter extends Abst
/**
* Constructs a new case-sensitive name file filter for a list of names.
- *
+ *
* @param names the names to allow, must not be null
* @throws IllegalArgumentException if the name list is null
* @throws ClassCastException if the list does not contain Strings
@@ -115,7 +115,7 @@ public class NameFileFilter extends Abst
/**
* Constructs a new name file filter for a list of names specifying case-sensitivity.
- *
+ *
* @param names the names to allow, must not be null
* @param caseSensitivity how to handle case sensitivity, null means case-sensitive
* @throws IllegalArgumentException if the name list is null
@@ -132,7 +132,7 @@ public class NameFileFilter extends Abst
//-----------------------------------------------------------------------
/**
* Checks to see if the filename matches.
- *
+ *
* @param file the File to check
* @return true if the filename matches
*/
@@ -149,7 +149,7 @@ public class NameFileFilter extends Abst
/**
* Checks to see if the filename matches.
- *
+ *
* @param dir the File directory (ignored)
* @param name the filename
* @return true if the filename matches
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/NotFileFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/NotFileFilter.java?rev=1471767&r1=1471766&r2=1471767&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/NotFileFilter.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/filefilter/NotFileFilter.java Wed Apr 24 23:24:19 2013
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,13 +27,13 @@ import java.io.Serializable;
* @see FileFilterUtils#notFileFilter(IOFileFilter)
*/
public class NotFileFilter extends AbstractFileFilter implements Serializable {
-
+
/** The filter */
private final IOFileFilter filter;
/**
* Constructs a new file filter that NOTs the result of another filter.
- *
+ *
* @param filter the filter, must not be null
* @throws IllegalArgumentException if the filter is null
*/
@@ -46,7 +46,7 @@ public class NotFileFilter extends Abstr
/**
* Returns the logical NOT of the underlying filter's return value for the same File.
- *
+ *
* @param file the File to check
* @return true if the filter returns false
*/
@@ -54,10 +54,10 @@ public class NotFileFilter extends Abstr
public boolean accept(final File file) {
return ! filter.accept(file);
}
-
+
/**
* Returns the logical NOT of the underlying filter's return value for the same arguments.
- *
+ *
* @param file the File directory
* @param name the filename
* @return true if the filter returns false
@@ -76,5 +76,5 @@ public class NotFileFilter extends Abstr
public String toString() {
return super.toString() + "(" + filter.toString() + ")";
}
-
+
}