SdkBufferedInputStream
.
A repeatable input stream wrapper for any input stream. This input stream
relies on buffered data to repeat, and can therefore only be repeated when
less data has been read than this buffer can hold.
Note: Always use a ResettableInputStream
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.
@Deprecated public class RepeatableInputStream extends SdkInputStream
Modifier and Type | Field and Description |
---|---|
private byte[] |
buffer
Deprecated.
|
private int |
bufferOffset
Deprecated.
|
private int |
bufferSize
Deprecated.
|
private long |
bytesReadPastMark
Deprecated.
|
private boolean |
hasWarnedBufferOverflow
Deprecated.
|
private java.io.InputStream |
is
Deprecated.
|
private static org.apache.commons.logging.Log |
log
Deprecated.
|
Constructor and Description |
---|
RepeatableInputStream(java.io.InputStream inputStream,
int bufferSize)
Deprecated.
Creates a repeatable input stream based on another input stream.
|
Modifier and Type | Method and Description |
---|---|
int |
available()
Deprecated.
|
void |
close()
Deprecated.
|
java.io.InputStream |
getWrappedInputStream()
Deprecated.
Returns the underlying input stream, if any, from the subclass; or null
if there is no underlying input stream.
|
void |
mark(int readlimit)
Deprecated.
This method can only be used while less data has been read from the input
stream than fits into the buffer.
|
boolean |
markSupported()
Deprecated.
|
int |
read()
Deprecated.
|
int |
read(byte[] out,
int outOffset,
int outLength)
Deprecated.
|
void |
reset()
Deprecated.
Resets the input stream to the beginning by pointing the buffer offset to
the beginning of the available data buffer.
|
abort, abortIfNeeded, isMetricActivated, release
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
private boolean hasWarnedBufferOverflow
public RepeatableInputStream(java.io.InputStream inputStream, int bufferSize)
inputStream
- The 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.InputStream
java.io.IOException
- When the available buffer size has been exceeded, in which
case the input stream data cannot be repeated.public boolean markSupported()
markSupported
in class java.io.InputStream
InputStream.markSupported()
public void mark(int readlimit)
mark
in class java.io.InputStream
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
InputStream.available()
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
InputStream.close()
public int read(byte[] out, int outOffset, int outLength) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
InputStream.read(byte[], int, int)
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
InputStream.read()
public java.io.InputStream getWrappedInputStream()
SdkInputStream
getWrappedInputStream
in class SdkInputStream