Skip to content

Commit 07c54a9

Browse files
author
Gary Gregory
committed
Javadoc exceptions.
1 parent ad1dcad commit 07c54a9

2 files changed

Lines changed: 24 additions & 26 deletions

File tree

src/main/java/org/apache/commons/io/FileUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ private static CopyOption[] addCopyAttributes(final CopyOption... copyOptions) {
860860
* @return the number of bytes copied
861861
* @throws NullPointerException if the File is {@code null}.
862862
* @throws NullPointerException if the OutputStream is {@code null}.
863-
* @throws IOException if an I/O error occurs
863+
* @throws IOException if an I/O error occurs.
864864
* @since 2.1
865865
*/
866866
public static long copyFile(final File input, final OutputStream output) throws IOException {
@@ -1028,10 +1028,10 @@ public static void copyToDirectory(final Iterable<File> sourceIterable, final Fi
10281028
* {@code null}
10291029
* @throws NullPointerException if the InputStream is {@code null}.
10301030
* @throws NullPointerException if the File is {@code null}.
1031-
* @throws IOException if <code>destination</code> is a directory
1032-
* @throws IOException if <code>destination</code> cannot be written
1033-
* @throws IOException if <code>destination</code> needs creating but can't be
1034-
* @throws IOException if an IO error occurs during copying
1031+
* @throws IllegalArgumentException if the file object is a directory.
1032+
* @throws IllegalArgumentException if the file is not writable.
1033+
* @throws IOException if the directories could not be created.
1034+
* @throws IOException if an IO error occurs during copying.
10351035
* @since 2.5
10361036
*/
10371037
public static void copyToFile(final InputStream inputStream, final File file) throws IOException {

src/main/java/org/apache/commons/io/IOUtils.java

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ public static void closeQuietly(final Writer writer) {
721721
* @return the number of bytes copied. or {@code 0} if {@code input is null}.
722722
* @throws NullPointerException if the InputStream is {@code null}.
723723
* @throws NullPointerException if the OutputStream is {@code null}.
724-
* @throws IOException if an I/O error occurs
724+
* @throws IOException if an I/O error occurs.
725725
* @since 2.8.0
726726
*/
727727
public static long consume(final InputStream input)
@@ -842,25 +842,22 @@ public static boolean contentEqualsIgnoreEOL(final Reader reader1, final Reader
842842
}
843843

844844
/**
845-
* Copies bytes from an <code>InputStream</code> to an
846-
* <code>OutputStream</code>.
845+
* Copies bytes from an <code>InputStream</code> to an <code>OutputStream</code>.
847846
* <p>
848-
* This method buffers the input internally, so there is no need to use a
849-
* <code>BufferedInputStream</code>.
847+
* This method buffers the input internally, so there is no need to use a <code>BufferedInputStream</code>.
850848
* </p>
851849
* <p>
852-
* Large streams (over 2GB) will return a bytes copied value of
853-
* <code>-1</code> after the copy has completed since the correct
854-
* number of bytes cannot be returned as an int. For large streams
855-
* use the <code>copyLarge(InputStream, OutputStream)</code> method.
850+
* Large streams (over 2GB) will return a bytes copied value of <code>-1</code> after the copy has completed since
851+
* the correct number of bytes cannot be returned as an int. For large streams use the
852+
* <code>copyLarge(InputStream, OutputStream)</code> method.
856853
* </p>
857854
*
858855
* @param inputStream the <code>InputStream</code> to read.
859856
* @param outputStream the <code>OutputStream</code> to write.
860857
* @return the number of bytes copied, or -1 if &gt; Integer.MAX_VALUE.
861858
* @throws NullPointerException if the InputStream is {@code null}.
862859
* @throws NullPointerException if the OutputStream is {@code null}.
863-
* @throws IOException if an I/O error occurs
860+
* @throws IOException if an I/O error occurs.
864861
* @since 1.1
865862
*/
866863
public static int copy(final InputStream inputStream, final OutputStream outputStream) throws IOException {
@@ -884,7 +881,7 @@ public static int copy(final InputStream inputStream, final OutputStream outputS
884881
* @return the number of bytes copied.
885882
* @throws NullPointerException if the InputStream is {@code null}.
886883
* @throws NullPointerException if the OutputStream is {@code null}.
887-
* @throws IOException if an I/O error occurs
884+
* @throws IOException if an I/O error occurs.
888885
* @since 2.5
889886
*/
890887
public static long copy(final InputStream inputStream, final OutputStream outputStream, final int bufferSize)
@@ -1142,7 +1139,7 @@ public static int copy(final Reader reader, final Writer writer) throws IOExcept
11421139
* @return the number of bytes copied.
11431140
* @throws NullPointerException if the InputStream is {@code null}.
11441141
* @throws NullPointerException if the OutputStream is {@code null}.
1145-
* @throws IOException if an I/O error occurs
1142+
* @throws IOException if an I/O error occurs.
11461143
* @since 1.3
11471144
*/
11481145
public static long copyLarge(final InputStream inputStream, final OutputStream outputStream)
@@ -1164,7 +1161,7 @@ public static long copyLarge(final InputStream inputStream, final OutputStream o
11641161
* @return the number of bytes copied.
11651162
* @throws NullPointerException if the InputStream is {@code null}.
11661163
* @throws NullPointerException if the OutputStream is {@code null}.
1167-
* @throws IOException if an I/O error occurs
1164+
* @throws IOException if an I/O error occurs.
11681165
* @since 2.2
11691166
*/
11701167
@SuppressWarnings("resource") // streams are closed by the caller.
@@ -2248,13 +2245,14 @@ public static BufferedReader toBufferedReader(final Reader reader, final int siz
22482245
* <code>BufferedInputStream</code>.
22492246
* </p>
22502247
*
2251-
* @param input the <code>InputStream</code> to read from
2248+
* @param inputStream the <code>InputStream</code> to read.
22522249
* @return the requested byte array
2253-
* @throws IOException if an I/O error occurs
2250+
* @throws NullPointerException if the InputStream is {@code null}.
2251+
* @throws IOException if an I/O error occurs.
22542252
*/
2255-
public static byte[] toByteArray(final InputStream input) throws IOException {
2253+
public static byte[] toByteArray(final InputStream inputStream) throws IOException {
22562254
try (final ByteArrayOutputStream output = new ByteArrayOutputStream()) {
2257-
copy(input, output);
2255+
copy(inputStream, output);
22582256
return output.toByteArray();
22592257
}
22602258
}
@@ -2436,10 +2434,10 @@ public static byte[] toByteArray(final URL url) throws IOException {
24362434
/**
24372435
* Gets the contents of a <code>URLConnection</code> as a <code>byte[]</code>.
24382436
*
2439-
* @param urlConn the <code>URLConnection</code> to read
2440-
* @return the requested byte array
2441-
* @throws NullPointerException if the urlConn is null
2442-
* @throws IOException if an I/O exception occurs
2437+
* @param urlConn the <code>URLConnection</code> to read.
2438+
* @return the requested byte array.
2439+
* @throws NullPointerException if the urlConn is null.
2440+
* @throws IOException if an I/O exception occurs.
24432441
* @since 2.4
24442442
*/
24452443
public static byte[] toByteArray(final URLConnection urlConn) throws IOException {

0 commit comments

Comments
 (0)