Class InputStreamWrapperChannel

    • Constructor Detail

      • InputStreamWrapperChannel

        public InputStreamWrapperChannel​(int buffSize)
    • Method Detail

      • read

        public final int read​(java.nio.ByteBuffer dst)
                       throws java.io.IOException
        Specified by:
        read in interface java.nio.channels.ReadableByteChannel
        Throws:
        java.io.IOException
      • getThreadLocalInstance

        public static BufferedReadableByteChannel getThreadLocalInstance​(java.io.InputStream in,
                                                                         long remainingSize)
                                                                  throws java.lang.IllegalStateException
        Wraps the given input stream into the special stateless and reusable (thread local) byte channel
        Parameters:
        in - the input stream to wrap
        remainingSize - the estimated size of the data to be read from the given input
        Returns:
        readable byte channel
        Throws:
        java.lang.IllegalStateException - if negative remaining size is specified
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.nio.channels.Channel
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException