public class RecordingInputStream
extends java.io.InputStream
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
drainBuffer
Reusable buffer to avoid reallocation on each readFullyUntil
|
protected static java.util.logging.Logger |
logger |
| Constructor and Description |
|---|
RecordingInputStream(int bufferSize,
java.lang.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(java.io.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(java.security.MessageDigest md)
Sets a digest function which may be applied to recorded data.
|
void |
setDigest(java.lang.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() |
protected static java.util.logging.Logger logger
protected byte[] drainBuffer
public RecordingInputStream(int bufferSize,
java.lang.String backingFilename)
bufferSize - Size of buffer to use.backingFilename - Name of backing file.public void open(java.io.InputStream wrappedStream)
throws java.io.IOException
java.io.IOExceptionpublic int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b)
throws java.io.IOException
read 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 ReplayInputStream getReplayInputStream() throws java.io.IOException
java.io.IOExceptionpublic ReplayInputStream getMessageBodyReplayInputStream() throws java.io.IOException
java.io.IOExceptionpublic long readFully()
throws java.io.IOException
java.io.IOExceptionpublic void readToEndOfContent(long contentLength)
throws java.io.IOException,
java.lang.InterruptedException
java.io.IOExceptionjava.lang.InterruptedExceptionpublic void readFullyOrUntil(long softMaxLength)
throws java.io.IOException,
RecorderLengthExceededException,
RecorderTimeoutException,
java.lang.InterruptedException
softMaxLength - Maximum length to read; if zero or < 0, then no
limit. If met, return normally.java.io.IOException - failed read.RecorderLengthExceededExceptionRecorderTimeoutExceptionjava.lang.InterruptedExceptionpublic long getSize()
public void markContentBegin()
public long getContentBegin()
public void startDigest()
public void setSha1Digest()
public void setDigest(java.lang.String algorithm)
algorithm - public void setDigest(java.security.MessageDigest md)
md - public byte[] getDigestValue()
public long getResponseContentLength()
public void closeRecorder()
throws java.io.IOException
java.io.IOExceptionpublic boolean isOpen()
public void mark(int readlimit)
mark in class java.io.InputStreampublic boolean markSupported()
markSupported in class java.io.InputStreampublic void reset()
throws java.io.IOException
reset in class java.io.InputStreamjava.io.IOExceptionpublic void setLimits(long hardMax,
long timeoutMs,
long maxRateKBps)
public int getRecordedBufferLength()
public void chopAtMessageBodyBegin()
public void clearForReuse()
throws java.io.IOException
java.io.IOExceptionCopyright © 2019 The International Internet Preservation Consortium. All Rights Reserved.