public class RecordingInputStream extends InputStream
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
drainBuffer
Reusable buffer to avoid reallocation on each readFullyUntil
|
protected static Logger |
logger |
| Constructor and Description |
|---|
RecordingInputStream(int bufferSize,
String backingFilename)
Create a new RecordingInputStream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
chopAtMessageBodyBegin()
|
void |
clearForReuse() |
void |
close() |
void |
closeRecorder() |
long |
getContentBegin() |
byte[] |
getDigestValue()
Return the digest value for any recorded, digested data.
|
ReplayInputStream |
getMessageBodyReplayInputStream() |
int |
getRecordedBufferLength()
Expose the amount of in-memory buffering used by the internal
recording stream.
|
ReplayInputStream |
getReplayInputStream() |
long |
getResponseContentLength() |
long |
getSize() |
boolean |
isOpen() |
void |
mark(int readlimit) |
void |
markContentBegin() |
boolean |
markSupported() |
void |
open(InputStream wrappedStream) |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
long |
readFully() |
void |
readFullyOrUntil(long softMaxLength)
Deprecated.
|
void |
readToEndOfContent(long contentLength) |
void |
reset() |
void |
setDigest(MessageDigest md)
Sets a digest function which may be applied to recorded data.
|
void |
setDigest(String algorithm)
Sets a digest algorithm which may be applied to recorded data.
|
void |
setLimits(long hardMax,
long timeoutMs,
long maxRateKBps)
Set limits to be enforced by internal recording-out
|
void |
setSha1Digest()
Convenience method for setting SHA1 digest.
|
void |
startDigest() |
available, skipprotected static Logger logger
protected byte[] drainBuffer
public RecordingInputStream(int bufferSize,
String backingFilename)
bufferSize - Size of buffer to use.backingFilename - Name of backing file.public void open(InputStream wrappedStream) throws IOException
IOExceptionpublic int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b)
throws IOException
read in class InputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic ReplayInputStream getReplayInputStream() throws IOException
IOExceptionpublic ReplayInputStream getMessageBodyReplayInputStream() throws IOException
IOExceptionpublic long readFully()
throws IOException
IOExceptionpublic void readToEndOfContent(long contentLength)
throws IOException,
InterruptedException
IOExceptionInterruptedExceptionpublic void readFullyOrUntil(long softMaxLength)
throws IOException,
RecorderLengthExceededException,
RecorderTimeoutException,
InterruptedException
softMaxLength - Maximum length to read; if zero or < 0, then no
limit. If met, return normally.IOException - failed read.RecorderLengthExceededExceptionRecorderTimeoutExceptionInterruptedExceptionpublic long getSize()
public void markContentBegin()
public long getContentBegin()
public void startDigest()
public void setSha1Digest()
public void setDigest(String algorithm)
algorithm - public void setDigest(MessageDigest md)
md - public byte[] getDigestValue()
public long getResponseContentLength()
public void closeRecorder()
throws IOException
IOExceptionpublic boolean isOpen()
public void mark(int readlimit)
mark in class InputStreampublic boolean markSupported()
markSupported in class InputStreampublic void reset()
throws IOException
reset in class InputStreamIOExceptionpublic void setLimits(long hardMax,
long timeoutMs,
long maxRateKBps)
public int getRecordedBufferLength()
public void chopAtMessageBodyBegin()
public void clearForReuse()
throws IOException
IOExceptionCopyright © 2015 The International Internet Preservation Consortium. All Rights Reserved.