This is an automated email from the ASF dual-hosted git repository. peterlee pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit 53bc2f725b006d54c1b1d94cc2970de818440dea Author: theobisproject <[email protected]> AuthorDate: Sat Dec 26 12:56:28 2020 +0100 COMPRESS-540: Rename BoundedNIOInputStream -> BoundedArchiveInputStream --- .../apache/commons/compress/archivers/tar/TarFile.java | 4 ++-- .../apache/commons/compress/archivers/zip/ZipFile.java | 6 +++--- ...InputStream.java => BoundedArchiveInputStream.java} | 18 +++++++++--------- .../utils/BoundedSeekableByteChannelInputStream.java | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java index 664d3ee..dfe5846 100644 --- a/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java +++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java @@ -38,7 +38,7 @@ import org.apache.commons.compress.archivers.zip.ZipEncoding; import org.apache.commons.compress.archivers.zip.ZipEncodingHelper; import org.apache.commons.compress.utils.ArchiveUtils; import org.apache.commons.compress.utils.BoundedInputStream; -import org.apache.commons.compress.utils.BoundedNIOInputStream; +import org.apache.commons.compress.utils.BoundedArchiveInputStream; import org.apache.commons.compress.utils.BoundedSeekableByteChannelInputStream; import org.apache.commons.compress.utils.SeekableInMemoryByteChannel; @@ -644,7 +644,7 @@ public class TarFile implements Closeable { archive.close(); } - private final class BoundedTarEntryInputStream extends BoundedNIOInputStream { + private final class BoundedTarEntryInputStream extends BoundedArchiveInputStream { private final SeekableByteChannel channel; diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java index cd52fe1..1a62ab8 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java @@ -45,7 +45,7 @@ import java.util.zip.ZipException; import org.apache.commons.compress.archivers.EntryStreamOffsets; import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream; import org.apache.commons.compress.compressors.deflate64.Deflate64CompressorInputStream; -import org.apache.commons.compress.utils.BoundedNIOInputStream; +import org.apache.commons.compress.utils.BoundedArchiveInputStream; import org.apache.commons.compress.utils.BoundedSeekableByteChannelInputStream; import org.apache.commons.compress.utils.CountingInputStream; import org.apache.commons.compress.utils.IOUtils; @@ -1316,7 +1316,7 @@ public class ZipFile implements Closeable { * Creates new BoundedInputStream, according to implementation of * underlying archive channel. */ - private BoundedNIOInputStream createBoundedInputStream(final long start, final long remaining) { + private BoundedArchiveInputStream createBoundedInputStream(final long start, final long remaining) { return archive instanceof FileChannel ? new BoundedFileChannelInputStream(start, remaining) : new BoundedSeekableByteChannelInputStream(start, remaining, archive); @@ -1328,7 +1328,7 @@ public class ZipFile implements Closeable { * file channel and therefore performs significantly faster in * concurrent environment. */ - private class BoundedFileChannelInputStream extends BoundedNIOInputStream { + private class BoundedFileChannelInputStream extends BoundedArchiveInputStream { private final FileChannel archive; BoundedFileChannelInputStream(final long start, final long remaining) { diff --git a/src/main/java/org/apache/commons/compress/utils/BoundedNIOInputStream.java b/src/main/java/org/apache/commons/compress/utils/BoundedArchiveInputStream.java similarity index 82% rename from src/main/java/org/apache/commons/compress/utils/BoundedNIOInputStream.java rename to src/main/java/org/apache/commons/compress/utils/BoundedArchiveInputStream.java index 2a692c0..db8d948 100644 --- a/src/main/java/org/apache/commons/compress/utils/BoundedNIOInputStream.java +++ b/src/main/java/org/apache/commons/compress/utils/BoundedArchiveInputStream.java @@ -26,7 +26,7 @@ import java.nio.ByteBuffer; * @ThreadSafe this base class is thread safe but implementations must not be. * @since 1.21 */ -public abstract class BoundedNIOInputStream extends InputStream { +public abstract class BoundedArchiveInputStream extends InputStream { private final long end; private ByteBuffer singleByteBuffer; @@ -35,10 +35,10 @@ public abstract class BoundedNIOInputStream extends InputStream { /** * Create a new bounded input stream. * - * @param start Position in the stream from where the reading of this bounded stream starts - * @param remaining Amount of bytes which are allowed to read from the bounded stream + * @param start position in the stream from where the reading of this bounded stream starts. + * @param remaining amount of bytes which are allowed to read from the bounded stream. */ - public BoundedNIOInputStream(final long start, final long remaining) { + public BoundedArchiveInputStream(final long start, final long remaining) { this.end = start + remaining; if (this.end < start) { // check for potential vulnerability due to overflow @@ -88,11 +88,11 @@ public abstract class BoundedNIOInputStream extends InputStream { } /** - * Read content of the stream into a {@link ByteBuffer} - * @param pos position to start the read - * @param buf buffer to add the read content - * @return Number of read bytes - * @throws IOException If I/O fails + * Read content of the stream into a {@link ByteBuffer}. + * @param pos position to start the read. + * @param buf buffer to add the read content. + * @return number of read bytes. + * @throws IOException if I/O fails. */ protected abstract int read(long pos, ByteBuffer buf) throws IOException; } diff --git a/src/main/java/org/apache/commons/compress/utils/BoundedSeekableByteChannelInputStream.java b/src/main/java/org/apache/commons/compress/utils/BoundedSeekableByteChannelInputStream.java index 9da4a34..75d352e 100644 --- a/src/main/java/org/apache/commons/compress/utils/BoundedSeekableByteChannelInputStream.java +++ b/src/main/java/org/apache/commons/compress/utils/BoundedSeekableByteChannelInputStream.java @@ -27,7 +27,7 @@ import java.nio.channels.SeekableByteChannel; * @ThreadSafe * @since 1.21 */ -public class BoundedSeekableByteChannelInputStream extends BoundedNIOInputStream { +public class BoundedSeekableByteChannelInputStream extends BoundedArchiveInputStream { private final SeekableByteChannel channel;
