org.archive.io
Class SafeSeekInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.archive.io.SeekInputStream
          extended by org.archive.io.SafeSeekInputStream
All Implemented Interfaces:
it.unimi.dsi.fastutil.io.RepositionableStream, java.io.Closeable

public class SafeSeekInputStream
extends SeekInputStream

Enables multiple concurrent streams based on the same underlying stream.

Author:
pjack

Constructor Summary
SafeSeekInputStream(SeekInputStream input)
          Constructor.
 
Method Summary
 long position()
           
 void position(long p)
           
 int read()
           
 int read(byte[] buf)
           
 int read(byte[] buf, int ofs, int len)
           
 long skip(long c)
           
 
Methods inherited from class org.archive.io.SeekInputStream
mark, markSupported, reset
 
Methods inherited from class java.io.InputStream
available, close
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SafeSeekInputStream

public SafeSeekInputStream(SeekInputStream input)
                    throws java.io.IOException
Constructor. The given stream will be positioned to 0 so that an accurate position can be tracked.

Parameters:
input - the underlying input stream
Throws:
java.io.IOException - if an IO error occurs
Method Detail

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] buf,
                int ofs,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] buf)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

skip

public long skip(long c)
          throws java.io.IOException
Overrides:
skip in class java.io.InputStream
Throws:
java.io.IOException

position

public void position(long p)
              throws java.io.IOException
Throws:
java.io.IOException

position

public long position()
              throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2003-2011 Internet Archive. All Rights Reserved.