Class ReadableBuffers.BufferInputStream

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()
      Returns the total number of bytes that can be read (or skipped over) from this object until all bytes have been read out.
      boolean byteBufferSupported()
      Indicates whether or not HasByteBuffer.getByteBuffer() operation is supported.
      void close()  
      java.io.InputStream detach()
      Detaches the underlying data source from this instance and transfers to an InputStream.
      java.nio.ByteBuffer getByteBuffer()
      Gets a ByteBuffer containing some bytes of the content next to be read, or null if has reached end of the content.
      void mark​(int readlimit)  
      boolean markSupported()  
      int read()  
      int read​(byte[] dest, int destOffset, int length)  
      void reset()  
      long skip​(long n)  
      • Methods inherited from class java.io.InputStream

        read
      • Methods inherited from class java.lang.Object

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

      • BufferInputStream

        public BufferInputStream​(ReadableBuffer buffer)
    • Method Detail

      • available

        public int available()
                      throws java.io.IOException
        Description copied from interface: KnownLength
        Returns the total number of bytes that can be read (or skipped over) from this object until all bytes have been read out.
        Specified by:
        available in interface KnownLength
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read()
        Specified by:
        read in class java.io.InputStream
      • read

        public int read​(byte[] dest,
                        int destOffset,
                        int length)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Overrides:
        skip in class java.io.InputStream
        Throws:
        java.io.IOException
      • mark

        public void mark​(int readlimit)
        Overrides:
        mark in class java.io.InputStream
      • reset

        public void reset()
                   throws java.io.IOException
        Overrides:
        reset in class java.io.InputStream
        Throws:
        java.io.IOException
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.InputStream
      • getByteBuffer

        @Nullable
        public java.nio.ByteBuffer getByteBuffer()
        Description copied from interface: HasByteBuffer
        Gets a ByteBuffer containing some bytes of the content next to be read, or null if has reached end of the content. The number of bytes contained in the returned buffer is implementation specific. Calling this method does not change the position of the input stream. The returned buffer's content should not be modified, but the position, limit, and mark may be changed. Operations for changing the position, limit, and mark of the returned buffer does not affect the position, limit, and mark of this input stream. This is an optional method, so callers should first check HasByteBuffer.byteBufferSupported().
        Specified by:
        getByteBuffer in interface HasByteBuffer
      • detach

        public java.io.InputStream detach()
        Description copied from interface: Detachable
        Detaches the underlying data source from this instance and transfers to an InputStream. Detaching data from an already-detached instance gives an InputStream with zero bytes of data.
        Specified by:
        detach in interface Detachable
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException