Interface ISeekableStream

All Known Subinterfaces:
IInStream, IOutStream
All Known Implementing Classes:
ByteArrayStream, RandomAccessFileInStream, RandomAccessFileOutStream, VolumedArchiveInStream

public interface ISeekableStream
Interface for seekable streams (random access streams).
Since:
9.20-2.00
Author:
Boris Brodski
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Indicates, that the seek operation should be done from the current position (file pointer) of the stream.
    static final int
    Indicates, that the seek operation should be done from the end of the stream.
    static final int
    Indicates, that the seek operation should be done from the beginning of the stream
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    seek(long offset, int seekOrigin)
    Move current location pointer to the new offset depending on seekOrigin.

    Note: depending on the archive format and the data size this method may be called from different threads.
  • Field Details

    • SEEK_SET

      static final int SEEK_SET
      Indicates, that the seek operation should be done from the beginning of the stream
      See Also:
    • SEEK_CUR

      static final int SEEK_CUR
      Indicates, that the seek operation should be done from the current position (file pointer) of the stream. Positive values move file pointer forward.
      See Also:
    • SEEK_END

      static final int SEEK_END
      Indicates, that the seek operation should be done from the end of the stream. Positive offset values move file pointer over the end of the stream. For the read only streams it's equivalent reaching end of the stream while reading.
      See Also:
  • Method Details

    • seek

      long seek(long offset, int seekOrigin) throws SevenZipException
      Move current location pointer to the new offset depending on seekOrigin.

      Note: depending on the archive format and the data size this method may be called from different threads. Synchronized implementation may be required.
      Parameters:
      offset - absolute or relative offset in the stream to move to
      seekOrigin - one of three possible seek origins:
      • SEEK_SET - offset is an absolute offset to move to,
      • SEEK_CUR - offset is a relative offset from the current position in the stream,
      • SEEK_END - offset is an offset from the end of the stream
      Returns:
      new absolute position in the stream.
      Throws:
      SevenZipException - in error case. If this method ends with an exception, the current operation will be reported to 7-Zip as failed. There is no guarantee that no further callback methods will be called. The first and last thrown exceptions will be saved and thrown later on from the originally called method such as IInArchive.extract() or SevenZip.openInArchive(). Up to four exceptions depending on the situation can be saved for further analysis. See SevenZipException and SevenZipException.printStackTraceExtended() for details.