|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.archive.util.HttpRecorder
public class HttpRecorder
Pairs together a RecordingInputStream and RecordingOutputStream
to capture exactly a single HTTP transaction.
Initially only supports HTTP/1.0 (one request, one response per stream)
Call markContentBegin()
to demarc the transition between HTTP
header and body.
Field Summary | |
---|---|
protected static java.util.logging.Logger |
logger
|
Constructor Summary | |
---|---|
protected |
HttpRecorder()
Constructor with limited access. |
|
HttpRecorder(java.io.File tempDir,
java.lang.String backingFilenameBase)
Create an HttpRecorder. |
|
HttpRecorder(java.io.File tempDir,
java.lang.String backingFilenameBase,
int outBufferSize,
int inBufferSize)
Create an HttpRecorder. |
Method Summary | |
---|---|
void |
cleanup()
Cleanup backing files. |
void |
close()
Close all streams. |
void |
closeRecorders()
Close both input and output recorders. |
java.lang.String |
getCharacterEncoding()
|
java.lang.String |
getContentReplayPrefixString(int size)
Return a short prefix of the presumed-textual content as a String. |
static HttpRecorder |
getHttpRecorder()
Get the current threads' HttpRecorder. |
RecordingInputStream |
getRecordedInput()
Return the internal RecordingInputStream |
RecordingOutputStream |
getRecordedOutput()
|
ReplayCharSequence |
getReplayCharSequence()
|
ReplayInputStream |
getReplayInputStream()
|
long |
getResponseContentLength()
|
java.io.InputStream |
inputWrap(java.io.InputStream is)
Wrap the provided stream with the internal RecordingInputStream open() throws an exception if RecordingInputStream is already open. |
void |
markContentBegin()
Mark current position as the point where the HTTP headers end. |
java.io.OutputStream |
outputWrap(java.io.OutputStream os)
Wrap the provided stream with the internal RecordingOutputStream open() throws an exception if RecordingOutputStream is already open. |
void |
setCharacterEncoding(java.lang.String characterEncoding)
|
static HttpRecorder |
wrapInputStreamWithHttpRecord(java.io.File dir,
java.lang.String basename,
java.io.InputStream in,
java.lang.String encoding)
Record the input stream for later playback by an extractor, etc. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.util.logging.Logger logger
Constructor Detail |
---|
protected HttpRecorder()
public HttpRecorder(java.io.File tempDir, java.lang.String backingFilenameBase, int outBufferSize, int inBufferSize)
tempDir
- Directory into which we drop backing files for
recorded input and output.backingFilenameBase
- Backing filename base to which we'll append
suffices ris
for recorded input stream and
ros
for recorded output stream.outBufferSize
- Size of output buffer to use.inBufferSize
- Size of input buffer to use.public HttpRecorder(java.io.File tempDir, java.lang.String backingFilenameBase)
tempDir
- Directory into which we drop backing files for recorded input
and output.backingFilenameBase
- Backing filename base to which we'll append suffices
ris
for recorded input stream and
ros
for recorded output stream.Method Detail |
---|
public java.io.InputStream inputWrap(java.io.InputStream is) throws java.io.IOException
is
- InputStream to wrap.
java.io.IOException
public java.io.OutputStream outputWrap(java.io.OutputStream os) throws java.io.IOException
os
- The output stream to wrap.
java.io.IOException
public void close()
public RecordingInputStream getRecordedInput()
public RecordingOutputStream getRecordedOutput()
public void markContentBegin()
public long getResponseContentLength()
public void closeRecorders()
close()
closes the stream that is being recorded and the
recorder. This method explicitly closes the recorder only.
public void cleanup()
public static HttpRecorder getHttpRecorder()
public void setCharacterEncoding(java.lang.String characterEncoding)
characterEncoding
- Character encoding of recording.public java.lang.String getCharacterEncoding()
public ReplayCharSequence getReplayCharSequence() throws java.io.IOException
java.io.IOException
java.io.IOException
public ReplayInputStream getReplayInputStream() throws java.io.IOException
java.io.IOException
public java.lang.String getContentReplayPrefixString(int size)
size
- max length of String to return
public static HttpRecorder wrapInputStreamWithHttpRecord(java.io.File dir, java.lang.String basename, java.io.InputStream in, java.lang.String encoding) throws java.io.IOException
dir
- Directory to write backing file to.basename
- of what we're recording.in
- Stream to read.encoding
- Stream encoding.
HttpRecorder
.
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |