Author: bodewig Date: Mon Oct 21 04:40:55 2013 New Revision: 1534022 URL: http://svn.apache.org/r1534022 Log: fix javadoc warnings and add a bunch of @throws
Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/BoundedInputStream.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/IOUtils.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java?rev=1534022&r1=1534021&r2=1534022&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java Mon Oct 21 04:40:55 2013 @@ -85,6 +85,7 @@ public class SevenZFile { * @param password optional password if the archive is encrypted - * the byte array is supposed to be the UTF16-LE encoded * representation of the password. + * @throws IOException if reading the archive fails */ public SevenZFile(final File filename, final byte[] password) throws IOException { boolean succeeded = false; @@ -104,6 +105,7 @@ public class SevenZFile { * Reads a file as unecrypted 7z archive * * @param filename the file to read + * @throws IOException if reading the archive fails */ public SevenZFile(final File filename) throws IOException { this(filename, null); @@ -111,6 +113,7 @@ public class SevenZFile { /** * Closes the archive. + * @throws IOException if closing the file fails */ public void close() throws IOException { if (file != null) { @@ -846,14 +849,39 @@ public class SevenZFile { } } + /** + * Reads a byte of data. + * + * @return the byte read, or -1 if end of input is reached + * @throws IOException + * if an I/O error has occurred + */ public int read() throws IOException { return currentEntryInputStream.read(); } + /** + * Reads data into an array of bytes. + * + * @param b the array to write data to + * @return the number of bytes read, or -1 if end of input is reached + * @throws IOException + * if an I/O error has occurred + */ public int read(byte[] b) throws IOException { return read(b, 0, b.length); } + /** + * Reads data into an array of bytes. + * + * @param b the array to write data to + * @param off offset into the buffer to start filling at + * @param len of bytes to read + * @return the number of bytes read, or -1 if end of input is reached + * @throws IOException + * if an I/O error has occurred + */ public int read(byte[] b, int off, int len) throws IOException { return currentEntryInputStream.read(b, off, len); } Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java?rev=1534022&r1=1534021&r2=1534022&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java Mon Oct 21 04:40:55 2013 @@ -48,6 +48,12 @@ public class SevenZOutputFile { private CountingOutputStream currentOutputStream; private SevenZMethod contentCompression = SevenZMethod.LZMA2; + /** + * Opens file to write a 7z archive to. + * + * @param filename name of the file to write to + * @throws IOException if opening the file fails + */ public SevenZOutputFile(final File filename) throws IOException { file = new RandomAccessFile(filename, "rw"); file.seek(SevenZFile.SIGNATURE_HEADER_SIZE); @@ -57,9 +63,9 @@ public class SevenZOutputFile { * Sets the compression method to use for entry contents - the * default is LZMA2. * - * <p>Currently only {@link SevenZMethod.COPY}, {@link - * SevenZMethod.LZMA2}, {@link SevenZMethod.BZIP2} and {@link - * SevenZMethod.DEFLATE} are supported.</p> + * <p>Currently only {@link SevenZMethod#COPY}, {@link + * SevenZMethod#LZMA2}, {@link SevenZMethod#BZIP2} and {@link + * SevenZMethod#DEFLATE} are supported.</p> */ public void setContentCompression(SevenZMethod method) { this.contentCompression = method; @@ -102,7 +108,7 @@ public class SevenZOutputFile { * The caller must then write the content to the archive and call * {@link #closeArchiveEntry()} to complete the process. * - * @param entry describes the entry + * @param archiveEntry describes the entry * @throws IOException */ public void putArchiveEntry(final ArchiveEntry archiveEntry) throws IOException { Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/BoundedInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/BoundedInputStream.java?rev=1534022&r1=1534021&r2=1534022&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/BoundedInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/BoundedInputStream.java Mon Oct 21 04:40:55 2013 @@ -29,6 +29,12 @@ public class BoundedInputStream extends private final InputStream in; private long bytesRemaining; + /** + * Creates the stream that will at most read the given amount of + * bytes from the given stream. + * @param in the stream to read from + * @param size the maximum amount of bytes to read + */ public BoundedInputStream(final InputStream in, final long size) { this.in = in; bytesRemaining = size; @@ -62,5 +68,7 @@ public class BoundedInputStream extends @Override public void close() { + // there isn't anything to close in this stream and the nested + // stream is controlled externally } } Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/IOUtils.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/IOUtils.java?rev=1534022&r1=1534021&r2=1534022&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/IOUtils.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/IOUtils.java Mon Oct 21 04:40:55 2013 @@ -104,7 +104,8 @@ public final class IOUtils { * * @param input stream to read from * @param b buffer to fill - * @retun the number of bytes actually read + * @return the number of bytes actually read + * @throws IOException */ public static int readFully(InputStream input, byte[] b) throws IOException { return readFully(input, b, 0, b.length); @@ -121,8 +122,10 @@ public final class IOUtils { * @param input stream to read from * @param b buffer to fill * @param offset offset into the buffer to start filling at - * @param amount of bytes to read - * @retun the number of bytes actually read + * @param len of bytes to read + * @return the number of bytes actually read + * @throws IOException + * if an I/O error has occurred */ public static int readFully(InputStream input, byte[] b, int offset, int len) throws IOException {