Class BlockedByteArrayInputStream

java.lang.Object
java.io.InputStream
org.apache.derby.impl.io.vfmem.BlockedByteArrayInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

class BlockedByteArrayInputStream extends InputStream
An input stream reading from a blocked byte array.
  • Field Details

    • src

      private BlockedByteArray src
      The underlying source. Set to null when closed.
    • pos

      private long pos
      The current position of the stream.
  • Constructor Details

    • BlockedByteArrayInputStream

      public BlockedByteArrayInputStream(BlockedByteArray src, long pos)
      Creates a new input stream reading from a blocked byte array.
      Parameters:
      src - the source blocked byte array
      pos - the initial position to start reading from
  • Method Details

    • setPosition

      void setPosition(long newPos)
      Sets the position.
      Parameters:
      newPos - the new byte position
    • getPosition

      long getPosition()
      Returns the current position.
      Returns:
      The current byte position.
    • read

      public int read()
      Reads a single byte.
      Specified by:
      read in class InputStream
      Returns:
      A byte.
    • read

      public int read(byte[] buf, int offset, int len)
      Reads up to len bytes.
      Overrides:
      read in class InputStream
      Parameters:
      buf - destination buffer
      offset - offset into the destination buffer
      len - number of bytes to read
      Returns:
      The number of bytes read.
    • close

      public void close()
      Closes the stream.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class InputStream