Class CompoundDocument.SeekableLittleEndianDataInputStream

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
com.twelvemonkeys.io.LittleEndianDataInputStream
com.twelvemonkeys.io.ole2.CompoundDocument.SeekableLittleEndianDataInputStream
All Implemented Interfaces:
Seekable, Closeable, DataInput, AutoCloseable
Enclosing class:
CompoundDocument

static class CompoundDocument.SeekableLittleEndianDataInputStream extends LittleEndianDataInputStream implements Seekable
  • Field Details

  • Constructor Details

    • SeekableLittleEndianDataInputStream

      public SeekableLittleEndianDataInputStream(SeekableInputStream pInput)
  • Method Details

    • seek

      public void seek(long pPosition) throws IOException
      Description copied from interface: Seekable
      Sets the current stream position to the desired location. The next read will occur at this location.

      An IndexOutOfBoundsException will be thrown if pPosition is smaller than the flushed position (as returned by Seekable.getFlushedPosition()).

      It is legal to seek past the end of the file; an EOFException will be thrown only if a read is performed.

      Specified by:
      seek in interface Seekable
      Parameters:
      pPosition - a long containing the desired file pointer position.
      Throws:
      IOException - if any other I/O error occurs.
    • isCachedFile

      public boolean isCachedFile()
      Description copied from interface: Seekable
      Returns true if this Seekable stream caches data itself in order to allow seeking backwards, and the cache is kept in a temporary file. Applications may consult this in order to decide how frequently, or whether, to flush in order to conserve cache resources.
      Specified by:
      isCachedFile in interface Seekable
      Returns:
      true if this Seekable caches data in a temporary file.
      See Also:
    • isCachedMemory

      public boolean isCachedMemory()
      Description copied from interface: Seekable
      Returns true if this Seekable stream caches data itself in order to allow seeking backwards, and the cache is kept in main memory. Applications may consult this in order to decide how frequently, or whether, to flush in order to conserve cache resources.
      Specified by:
      isCachedMemory in interface Seekable
      Returns:
      true if this Seekable caches data in main memory.
      See Also:
    • isCached

      public boolean isCached()
      Description copied from interface: Seekable
      Returns true if this Seekable stream caches data itself in order to allow seeking backwards. Applications may consult this in order to decide how frequently, or whether, to flush in order to conserve cache resources.
      Specified by:
      isCached in interface Seekable
      Returns:
      true if this Seekable caches data.
      See Also:
    • getStreamPosition

      public long getStreamPosition() throws IOException
      Description copied from interface: Seekable
      Returns the current byte position of the stream. The next read will take place starting at this offset.
      Specified by:
      getStreamPosition in interface Seekable
      Returns:
      a long containing the position of the stream.
      Throws:
      IOException - if an I/O error occurs.
    • getFlushedPosition

      public long getFlushedPosition() throws IOException
      Description copied from interface: Seekable
      Returns the earliest position in the stream to which seeking may be performed. The returned value will be the maximum of all values passed into previous calls to flushBefore.
      Specified by:
      getFlushedPosition in interface Seekable
      Returns:
      the earliest legal position for seeking, as a long.
      Throws:
      IOException - if an I/O error occurs.
    • flushBefore

      public void flushBefore(long pPosition) throws IOException
      Description copied from interface: Seekable
      Discards the initial portion of the stream prior to the indicated postion. Attempting to seek to an offset within the flushed portion of the stream will result in an IndexOutOfBoundsException.

      Calling flushBefore may allow classes implementing this interface to free up resources such as memory or disk space that are being used to store data from the stream.

      Specified by:
      flushBefore in interface Seekable
      Parameters:
      pPosition - a long containing the length of the file prefix that may be flushed.
      Throws:
      IOException - if an I/O error occurs.
    • flush

      public void flush() throws IOException
      Description copied from interface: Seekable
      Discards the initial position of the stream prior to the current stream position. Equivalent to flushBefore(getStreamPosition()).
      Specified by:
      flush in interface Seekable
      Throws:
      IOException - if an I/O error occurs.
    • reset

      public void reset() throws IOException
      Description copied from interface: Seekable
      Returns the file pointer to its previous position, at the time of the most recent unmatched call to mark.

      Calls to reset without a corresponding call to mark will either:

      • throw an IOException
      • or, reset to the beginning of the stream.

      An IOException will be thrown if the previous marked position lies in the discarded portion of the stream.

      Specified by:
      reset in interface Seekable
      Overrides:
      reset in class FilterInputStream
      Throws:
      IOException - if an I/O error occurs.
      See Also:
    • mark

      public void mark()
      Description copied from interface: Seekable
      Marks a position in the stream to be returned to by a subsequent call to reset. Unlike a standard InputStream, all Seekable streams upport marking. Additionally, calls to mark and reset may be nested arbitrarily.

      Unlike the mark methods declared by the Reader or InputStream interfaces, no readLimit parameter is used. An arbitrary amount of data may be read following the call to mark.

      Specified by:
      mark in interface Seekable