public class RepeatableInputStream extends java.io.InputStream implements InputStreamWrapper
Note: Always use a RepeatableFileInputStream instead of this class if you are
sourcing data from a file, as the file-based repeatable input stream can be repeated without
any limitations.
This class uses properties obtained through Jets3tProperties. For more information on
these properties please refer to
JetS3t Configuration
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
buffer |
private int |
bufferOffset |
private int |
bufferSize |
private long |
bytesReadPastMark |
private java.io.InputStream |
is |
private static org.apache.commons.logging.Log |
log |
| Constructor and Description |
|---|
RepeatableInputStream(java.io.InputStream inputStream,
int bufferSize)
Creates a repeatable input stream based on another input stream.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
java.io.InputStream |
getWrappedInputStream() |
void |
mark(int readlimit)
This method can only be used while less data has been read from the input
stream than fits into the buffer.
|
boolean |
markSupported() |
int |
read() |
int |
read(byte[] out,
int outOffset,
int outLength) |
void |
reset()
Resets the input stream to the beginning by pointing the buffer offset to the beginning of the
available data buffer.
|
private static final org.apache.commons.logging.Log log
private java.io.InputStream is
private int bufferSize
private int bufferOffset
private long bytesReadPastMark
private byte[] buffer
public RepeatableInputStream(java.io.InputStream inputStream,
int bufferSize)
inputStream - an input stream to wrap. The data read from the wrapped input stream is buffered as it is
read, up to the buffer limit specified.bufferSize - the number of bytes buffered by this class.public void reset()
throws java.io.IOException
reset in class java.io.InputStreamUnrecoverableIOException - when the available buffer size has been exceeded, in which case the input stream data cannot
be repeated.java.io.IOExceptionpublic boolean markSupported()
markSupported in class java.io.InputStreampublic void mark(int readlimit)
mark in class java.io.InputStreampublic int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] out,
int outOffset,
int outLength)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic java.io.InputStream getWrappedInputStream()
getWrappedInputStream in interface InputStreamWrapper