Skip to content

Commit

Permalink
Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Jun 18, 2024
1 parent ec512f0 commit c9fd7fc
Show file tree
Hide file tree
Showing 23 changed files with 57 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/apache/commons/io/CopyUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
* Imagine that an InputStream's read() is a very expensive operation, which
* would usually suggest wrapping in a BufferedInputStream. The
* BufferedInputStream works by issuing infrequent
* {@link java.io.InputStream#read(byte[] b, int off, int len)} requests on the
* {@link InputStream#read(byte[] b, int off, int len)} requests on the
* underlying InputStream, to fill an internal buffer, from which further
* {@code read} requests can inexpensively get their data (until the buffer
* runs out).
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/apache/commons/io/FileSystemUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.commons.io;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -25,7 +26,7 @@
/**
* General File System utilities.
* <p>
* This class provides static utility methods for general file system functions not provided before Java 6's {@link java.io.File File} class.
* This class provides static utility methods for general file system functions not provided before Java 6's {@link File File} class.
* </p>
* <p>
* The current functions provided are:
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/commons/io/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,7 @@ public static File getTempDirectory() {
* WARNING: this method relies on the Java system property 'java.io.tmpdir'
* which may or may not have a trailing file separator.
* This can affect code that uses String processing to manipulate pathnames rather
* than the standard libary methods in classes such as {@link java.io.File}
* than the standard libary methods in classes such as {@link File}
*
* @return the path to the system temporary directory as a String
* @since 2.0
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/apache/commons/io/FilenameUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
* </p>
* <p>
* <b>NOTE</b>: You may be able to avoid using this class entirely simply by
* using JDK {@link java.io.File File} objects and the two argument constructor
* {@link java.io.File#File(java.io.File, String) File(File,String)}.
* using JDK {@link File File} objects and the two argument constructor
* {@link File#File(java.io.File, String) File(File,String)}.
* </p>
* <p>
* Most methods in this class are designed to work the same on both UNIX and Windows.
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/apache/commons/io/IOCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.commons.io;

import java.io.File;
import java.util.Objects;
import java.util.stream.Stream;

Expand Down Expand Up @@ -56,7 +57,7 @@ public enum IOCase {
* <strong>Note:</strong> This only caters for Windows and Unix. Other operating
* systems (e.g. OSX and OpenVMS) are treated as case-sensitive if they use the
* UNIX file separator and case-insensitive if they use the Windows file separator
* (see {@link java.io.File#separatorChar}).
* (see {@link File#separatorChar}).
* </p>
* <p>
* If you serialize this constant on Windows, and deserialize on Unix, or vice
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/org/apache/commons/io/IOUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.io.Reader;
import java.io.UncheckedIOException;
import java.io.Writer;
Expand Down Expand Up @@ -1184,9 +1186,9 @@ public static void copy(final InputStream input, final Writer writer, final Stri
}

/**
* Copies bytes from a {@link java.io.ByteArrayOutputStream} to a {@link QueueInputStream}.
* Copies bytes from a {@link ByteArrayOutputStream} to a {@link QueueInputStream}.
* <p>
* Unlike using JDK {@link java.io.PipedInputStream} and {@link java.io.PipedOutputStream} for this, this
* Unlike using JDK {@link PipedInputStream} and {@link PipedOutputStream} for this, this
* solution works safely in a single thread environment.
* </p>
* <p>
Expand All @@ -1200,9 +1202,9 @@ public static void copy(final InputStream input, final Writer writer, final Stri
* InputStream inputStream = IOUtils.copy(outputStream);
* </pre>
*
* @param outputStream the {@link java.io.ByteArrayOutputStream} to read.
* @param outputStream the {@link ByteArrayOutputStream} to read.
* @return the {@link QueueInputStream} filled with the content of the outputStream.
* @throws NullPointerException if the {@link java.io.ByteArrayOutputStream} is {@code null}.
* @throws NullPointerException if the {@link ByteArrayOutputStream} is {@code null}.
* @throws IOException if an I/O error occurs.
* @since 2.12
*/
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/apache/commons/io/file/PathUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,11 @@ public static Path current() {
/**
* Deletes a file or directory. If the path is a directory, delete it and all subdirectories.
* <p>
* The difference between File.delete() and this method are:
* The difference between {@link File#delete()} and this method are:
* </p>
* <ul>
* <li>A directory to delete does not have to be empty.</li>
* <li>You get exceptions when a file or directory cannot be deleted; {@link java.io.File#delete()} returns a boolean.
* <li>You get exceptions when a file or directory cannot be deleted; {@link File#delete()} returns a boolean.
* </ul>
*
* @param path file or directory to delete, must not be {@code null}
Expand All @@ -439,7 +439,7 @@ public static PathCounters delete(final Path path) throws IOException {
* </p>
* <ul>
* <li>A directory to delete does not have to be empty.</li>
* <li>You get exceptions when a file or directory cannot be deleted; {@link java.io.File#delete()} returns a boolean.
* <li>You get exceptions when a file or directory cannot be deleted; {@link File#delete()} returns a boolean.
* </ul>
*
* @param path file or directory to delete, must not be {@code null}
Expand All @@ -461,7 +461,7 @@ public static PathCounters delete(final Path path, final DeleteOption... deleteO
* </p>
* <ul>
* <li>A directory to delete does not have to be empty.</li>
* <li>You get exceptions when a file or directory cannot be deleted; {@link java.io.File#delete()} returns a boolean.
* <li>You get exceptions when a file or directory cannot be deleted; {@link File#delete()} returns a boolean.
* </ul>
*
* @param path file or directory to delete, must not be {@code null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.commons.io.filefilter;

import java.io.File;
import java.io.FileFilter;
import java.io.Serializable;
import java.nio.file.FileVisitResult;
import java.nio.file.Path;
Expand All @@ -28,7 +29,7 @@
import java.util.stream.Stream;

/**
* A {@link java.io.FileFilter} providing conditional AND logic across a list of
* A {@link FileFilter} providing conditional AND logic across a list of
* file filters. This filter returns {@code true} if all filters in the
* list return {@code true}. Otherwise, it returns {@code false}.
* Checking of the file filter list stops when the first filter returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public interface IOFileFilter extends FileFilter, FilenameFilter, PathFilter, Pa
/**
* Tests if a File should be accepted by this filter.
* <p>
* Defined in {@link java.io.FileFilter}.
* Defined in {@link FileFilter}.
* </p>
*
* @param file the File to check.
Expand All @@ -53,7 +53,7 @@ public interface IOFileFilter extends FileFilter, FilenameFilter, PathFilter, Pa
/**
* Tests if a File should be accepted by this filter.
* <p>
* Defined in {@link java.io.FilenameFilter}.
* Defined in {@link FilenameFilter}.
* </p>
*
* @param dir the directory File to check.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.commons.io.filefilter;

import java.io.File;
import java.io.FileFilter;
import java.io.Serializable;
import java.nio.file.FileVisitResult;
import java.nio.file.Path;
Expand All @@ -28,7 +29,7 @@
import java.util.stream.Stream;

/**
* A {@link java.io.FileFilter} providing conditional OR logic across a list of file filters. This filter returns
* A {@link FileFilter} providing conditional OR logic across a list of file filters. This filter returns
* {@code true} if any filters in the list return {@code true}. Otherwise, it returns {@code false}. Checking of the
* file filter list stops when the first filter returns {@code true}.
* <h2>Deprecating Serialization</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* when this limit is reached, regardless of state of underlying reader.
*
* <p>
* One use case is to avoid overrunning the readAheadLimit supplied to {@link java.io.Reader#mark(int)}, since reading
* One use case is to avoid overrunning the readAheadLimit supplied to {@link Reader#mark(int)}, since reading
* too many characters removes the ability to do a successful reset.
* </p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import static org.apache.commons.io.IOUtils.EOF;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
Expand All @@ -29,7 +30,7 @@

/**
* {@link InputStream} implementation which uses direct buffer to read a file to avoid extra copy of data between Java and native memory which happens when
* using {@link java.io.BufferedInputStream}. Unfortunately, this is not something already available in JDK, {@code sun.nio.ch.ChannelInputStream} supports
* using {@link BufferedInputStream}. Unfortunately, this is not something already available in JDK, {@code sun.nio.ch.ChannelInputStream} supports
* reading a file using NIO, but does not support buffering.
* <p>
* To build an instance, use {@link Builder}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
*/
package org.apache.commons.io.input;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
* This is an alternative to {@link java.io.ByteArrayInputStream}
* This is an alternative to {@link ByteArrayInputStream}
* which removes the synchronization overhead for non-concurrent
* access; as such this class is not thread-safe.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.apache.commons.io.output.QueueOutputStream;

/**
* Simple alternative to JDK {@link java.io.PipedInputStream}; queue input stream provides what's written in queue output stream.
* Simple alternative to JDK {@link PipedInputStream}; queue input stream provides what's written in queue output stream.
* <p>
* To build an instance, use {@link Builder}.
* </p>
Expand Down
11 changes: 7 additions & 4 deletions src/main/java/org/apache/commons/io/input/ReaderInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@

import static org.apache.commons.io.IOUtils.EOF;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
Expand All @@ -42,10 +45,10 @@
* Since in general it is not possible to predict the number of characters to be read from the {@link Reader} to satisfy a read request on the
* {@link ReaderInputStream}, all reads from the {@link Reader} are buffered. There is therefore no well defined correlation between the current position of the
* {@link Reader} and that of the {@link ReaderInputStream}. This also implies that in general there is no need to wrap the underlying {@link Reader} in a
* {@link java.io.BufferedReader}.
* {@link BufferedReader}.
* </p>
* <p>
* {@link ReaderInputStream} implements the inverse transformation of {@link java.io.InputStreamReader}; in the following example, reading from {@code in2}
* {@link ReaderInputStream} implements the inverse transformation of {@link InputStreamReader}; in the following example, reading from {@code in2}
* would return the same byte sequence as reading from {@code in} (provided that the initial byte sequence is legal with respect to the charset encoding):
* </p>
* <p>
Expand All @@ -61,8 +64,8 @@
* .get();
* </pre>
* <p>
* {@link ReaderInputStream} implements the same transformation as {@link java.io.OutputStreamWriter}, except that the control flow is reversed: both classes
* transform a character stream into a byte stream, but {@link java.io.OutputStreamWriter} pushes data to the underlying stream, while {@link ReaderInputStream}
* {@link ReaderInputStream} implements the same transformation as {@link OutputStreamWriter}, except that the control flow is reversed: both classes
* transform a character stream into a byte stream, but {@link OutputStreamWriter} pushes data to the underlying stream, while {@link ReaderInputStream}
* pulls it from the underlying stream.
* </p>
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.apache.commons.io.build.AbstractStreamBuilder;

/**
* This is an alternative to {@link java.io.ByteArrayInputStream} which removes the synchronization overhead for non-concurrent access; as such this class is
* This is an alternative to {@link ByteArrayInputStream} which removes the synchronization overhead for non-concurrent access; as such this class is
* not thread-safe.
* <p>
* To build an instance, use {@link Builder}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static org.apache.commons.io.IOUtils.EOF;

import java.io.BufferedInputStream;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
Expand All @@ -27,7 +28,7 @@

/**
* Implements a buffered input stream, which is internally based on a {@link CircularByteBuffer}. Unlike the
* {@link java.io.BufferedInputStream}, this one doesn't need to reallocate byte arrays internally.
* {@link BufferedInputStream}, this one doesn't need to reallocate byte arrays internally.
*
* @since 2.7
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@

import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;

/**
* OutputStream implementation that writes the data to an {@link Appendable}
* Object.
* <p>
* For example, can be used with any {@link java.io.Writer} or a {@link StringBuilder}
* For example, can be used with any {@link Writer} or a {@link StringBuilder}
* or {@link StringBuffer}.
* </p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* </p>
* <p>
* The encoding must be specified using either the name of the {@link Charset}, the {@link Charset}, or a {@link CharsetEncoder}. If the default encoding is
* required then use the {@link java.io.FileWriter} directly, rather than this implementation.
* required then use the {@link FileWriter} directly, rather than this implementation.
* </p>
* <p>
* To build an instance, use {@link Builder}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.nio.charset.Charset;
import java.util.Objects;
Expand Down Expand Up @@ -265,7 +266,7 @@ public LockableFileWriter(final File file, final Charset charset, final boolean
* @param charsetName the name of the requested charset, null means platform default
* @throws NullPointerException if the file is null
* @throws IOException in case of an I/O error
* @throws java.nio.charset.UnsupportedCharsetException thrown instead of {@link java.io.UnsupportedEncodingException} in version 2.2 if the encoding is not
* @throws java.nio.charset.UnsupportedCharsetException thrown instead of {@link UnsupportedEncodingException} in version 2.2 if the encoding is not
* supported.
* @deprecated Use {@link #builder()}, {@link Builder}, and {@link Builder#get()}
*/
Expand All @@ -283,7 +284,7 @@ public LockableFileWriter(final File file, final String charsetName) throws IOEx
* @param lockDir the directory in which the lock file should be held
* @throws NullPointerException if the file is null
* @throws IOException in case of an I/O error
* @throws java.nio.charset.UnsupportedCharsetException thrown instead of {@link java.io.UnsupportedEncodingException} in version 2.2 if the encoding is not
* @throws java.nio.charset.UnsupportedCharsetException thrown instead of {@link UnsupportedEncodingException} in version 2.2 if the encoding is not
* supported.
* @deprecated Use {@link #builder()}, {@link Builder}, and {@link Builder#get()}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.apache.commons.io.input.QueueInputStream;

/**
* Simple alternative to JDK {@link java.io.PipedOutputStream}; queue input stream provides what's written in queue
* Simple alternative to JDK {@link PipedOutputStream}; queue input stream provides what's written in queue
* output stream.
* <p>
* Example usage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@
package org.apache.commons.io.output;

import java.io.Serializable;
import java.io.StringWriter;
import java.io.Writer;

/**
* {@link Writer} implementation that outputs to a {@link StringBuilder}.
* <p>
* <strong>NOTE:</strong> This implementation, as an alternative to
* {@link java.io.StringWriter}, provides an <i>un-synchronized</i>
* {@link StringWriter}, provides an <i>un-synchronized</i>
* (i.e. for use in a single thread) implementation for better performance.
* For safe usage with multiple {@link Thread}s then
* {@link java.io.StringWriter} should be used.
* {@link StringWriter} should be used.
* </p>
* <h2>Deprecating Serialization</h2>
* <p>
Expand Down
Loading

0 comments on commit c9fd7fc

Please sign in to comment.