Class RandomAccessInputStream

All Implemented Interfaces:
RepositionableStream, Closeable, AutoCloseable

public class RandomAccessInputStream extends SeekInputStream
Wraps a RandomAccessFile with an InputStream interface.
Author:
gojomo
  • Constructor Details

    • RandomAccessInputStream

      public RandomAccessInputStream(RandomAccessFile raf) throws IOException
      Constructor. If using this constructor, caller created the RAF and therefore its assumed wants to control close of the RAF. The RAF.close is not called if this constructor is used on close of this stream.
      Parameters:
      raf - RandomAccessFile to wrap.
      Throws:
      IOException
    • RandomAccessInputStream

      public RandomAccessInputStream(File file) throws IOException
      Constructor.
      Parameters:
      file - File to get RAFIS on. Creates an RAF from passed file. Closes the created RAF when this stream is closed.
      Throws:
      IOException
    • RandomAccessInputStream

      public RandomAccessInputStream(File file, long offset) throws IOException
      Constructor.
      Parameters:
      file - File to get RAFIS on. Creates an RAF from passed file. Closes the created RAF when this stream is closed.
      offset -
      Throws:
      IOException
    • RandomAccessInputStream

      public RandomAccessInputStream(RandomAccessFile raf, boolean sympathyClose, long offset) throws IOException
      Parameters:
      raf - RandomAccessFile to wrap.
      sympathyClose - Set to true if we are to close the RAF file when this stream is closed.
      offset -
      Throws:
      IOException
  • Method Details