Class ArraySeekInputStream

All Implemented Interfaces:
RepositionableStream, Closeable, AutoCloseable

public class ArraySeekInputStream extends SeekInputStream
A repositionable stream backed by an array.
Author:
pjack
  • Constructor Details

    • ArraySeekInputStream

      public ArraySeekInputStream(byte[] array)
      Constructor. Note that changes to the given array will be reflected in the stream.
      Parameters:
      array - The array to read bytes from.
  • Method Details

    • read

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

      public int read(byte[] buf, int ofs, int len)
      Overrides:
      read in class InputStream
    • read

      public int read(byte[] buf)
      Overrides:
      read in class InputStream
    • position

      public long position()
      Returns the position of the stream.
      Returns:
      the current stream position.
    • position

      public void position(long p) throws IOException
      Repositions the stream.
      Parameters:
      p - the new position for the stream
      Throws:
      IOException - if the given position is out of bounds