Class ArraySeekInputStream
java.lang.Object
java.io.InputStream
org.archive.io.SeekInputStream
org.archive.io.ArraySeekInputStream
- All Implemented Interfaces:
RepositionableStream,Closeable,AutoCloseable
A repositionable stream backed by an array.
- Author:
- pjack
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.archive.io.SeekInputStream
mark, markSupported, resetMethods inherited from class java.io.InputStream
available, close, skip
-
Constructor Details
-
ArraySeekInputStream
public ArraySeekInputStream(byte[] array) Constructor. Note that changes to the given array will be reflected in the stream.- Parameters:
array- The array to read bytes from.
-
-
Method Details
-
read
public int read()- Specified by:
readin classInputStream
-
read
public int read(byte[] buf, int ofs, int len) - Overrides:
readin classInputStream
-
read
public int read(byte[] buf) - Overrides:
readin classInputStream
-
position
public long position()Returns the position of the stream.- Returns:
- the current stream position.
-
position
Repositions the stream.- Parameters:
p- the new position for the stream- Throws:
IOException- if the given position is out of bounds
-