Class FileCacheSeekableStream

All Implemented Interfaces:
Seekable, Closeable, AutoCloseable

public final class FileCacheSeekableStream extends AbstractCachedSeekableStream
A SeekableInputStream implementation that caches data in a temporary File.

Temporary files are created as specified in File.createTempFile(String, String, java.io.File).

Version:
$Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/io/FileCacheSeekableStream.java#5 $
See Also:
  • Field Details

    • buffer

      private byte[] buffer
  • Constructor Details

    • FileCacheSeekableStream

      public FileCacheSeekableStream(InputStream pStream) throws IOException
      Creates a FileCacheSeekableStream reading from the given InputStream. Data will be cached in a temporary file.
      Parameters:
      pStream - the InputStream to read from
      Throws:
      IOException - if the temporary file cannot be created, or cannot be opened for random access.
    • FileCacheSeekableStream

      public FileCacheSeekableStream(InputStream pStream, String pTempBaseName) throws IOException
      Creates a FileCacheSeekableStream reading from the given InputStream. Data will be cached in a temporary file, with the given base name.
      Parameters:
      pStream - the InputStream to read from
      pTempBaseName - optional base name for the temporary file
      Throws:
      IOException - if the temporary file cannot be created, or cannot be opened for random access.
    • FileCacheSeekableStream

      public FileCacheSeekableStream(InputStream pStream, String pTempBaseName, File pTempDir) throws IOException
      Creates a FileCacheSeekableStream reading from the given InputStream. Data will be cached in a temporary file, with the given base name, in the given directory
      Parameters:
      pStream - the InputStream to read from
      pTempBaseName - optional base name for the temporary file
      pTempDir - optional temp directory
      Throws:
      IOException - if the temporary file cannot be created, or cannot be opened for random access.
    • FileCacheSeekableStream

      FileCacheSeekableStream(InputStream pStream, File pFile) throws FileNotFoundException
      Throws:
      FileNotFoundException
  • Method Details