Class ZipFile.BoundedFileChannelInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
    Enclosing class:
    ZipFile

    private static class ZipFile.BoundedFileChannelInputStream
    extends BoundedArchiveInputStream
    Lock-free implementation of BoundedInputStream. The implementation uses positioned reads on the underlying archive file channel and therefore performs significantly faster in concurrent environment.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.nio.channels.FileChannel archive  
    • Constructor Summary

      Constructors 
      Constructor Description
      BoundedFileChannelInputStream​(long start, long remaining, java.nio.channels.FileChannel archive)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected int read​(long pos, java.nio.ByteBuffer buf)
      Read content of the stream into a ByteBuffer.
      • Methods inherited from class java.io.InputStream

        available, close, mark, markSupported, read, reset, skip
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • archive

        private final java.nio.channels.FileChannel archive
    • Constructor Detail

      • BoundedFileChannelInputStream

        BoundedFileChannelInputStream​(long start,
                                      long remaining,
                                      java.nio.channels.FileChannel archive)
    • Method Detail

      • read

        protected int read​(long pos,
                           java.nio.ByteBuffer buf)
                    throws java.io.IOException
        Description copied from class: BoundedArchiveInputStream
        Read content of the stream into a ByteBuffer.
        Specified by:
        read in class BoundedArchiveInputStream
        Parameters:
        pos - position to start the read.
        buf - buffer to add the read content.
        Returns:
        number of read bytes.
        Throws:
        java.io.IOException - if I/O fails.