public class ReplayInputStream extends SeekInputStream
| Modifier and Type | Field and Description |
|---|---|
protected File |
backingFile |
protected long |
responseBodyStart
Where the response body starts, if marked
|
| Constructor and Description |
|---|
ReplayInputStream(byte[] buffer,
long size,
long responseBodyStart,
String backingFilename)
Constructor.
|
ReplayInputStream(byte[] buffer,
long size,
String backingFilename)
Constructor.
|
ReplayInputStream(InputStream fillStream)
Create a ReplayInputStream from the given source stream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
destroy()
Close & destroy any internally-generated temporary files.
|
protected byte[] |
getBuffer() |
long |
getContentSize()
Total size of content.
|
long |
getHeaderSize()
Total size of header.
|
long |
getSize()
Total size of stream content.
|
long |
position() |
void |
position(long p)
Reposition the stream.
|
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
readContentTo(OutputStream os) |
void |
readContentTo(OutputStream os,
long maxSize)
Convenience method to copy content out to target stream.
|
static void |
readFullyTo(InputStream in,
OutputStream os) |
void |
readFullyTo(OutputStream os) |
void |
readHeaderTo(OutputStream os) |
long |
remaining() |
long |
setToResponseBodyStart() |
protected void |
setupDiskStream(File backingFile) |
mark, markSupported, resetavailable, read, skipprotected long responseBodyStart
protected File backingFile
public ReplayInputStream(byte[] buffer,
long size,
long responseBodyStart,
String backingFilename)
throws IOException
buffer - Buffer to read from.size - Size of data to replay.responseBodyStart - Start of the response body.backingFilename - Backing file that sits behind the buffer. If
size > than buffer then we go to backing file to read
data that is beyond buffer.length.IOException - If we fail to open an input stream on
backing file.public ReplayInputStream(byte[] buffer,
long size,
String backingFilename)
throws IOException
buffer - Buffer to read from.size - Size of data to replay.backingFilename - Backing file that sits behind the buffer. If
size > than buffer then we go to backing file to read
data that is beyond buffer.length.IOException - If we fail to open an input stream on
backing file.public ReplayInputStream(InputStream fillStream) throws IOException
fillStream - IOExceptionprotected void setupDiskStream(File backingFile) throws IOException
IOExceptionpublic void destroy()
public long setToResponseBodyStart()
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 void readFullyTo(OutputStream os) throws IOException
IOExceptionpublic static void readFullyTo(InputStream in, OutputStream os) throws IOException
IOExceptionpublic void readHeaderTo(OutputStream os) throws IOException
IOExceptionpublic void readContentTo(OutputStream os) throws IOException
IOExceptionpublic void readContentTo(OutputStream os, long maxSize) throws IOException
os - stream to write content tomaxSize - maximum count of bytes to copyIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic long getSize()
public long getHeaderSize()
public long getContentSize()
public long remaining()
public void position(long p)
throws IOException
p - the new position for this streamIOException - if an IO error occurspublic long position()
throws IOException
IOExceptionprotected byte[] getBuffer()
Copyright © 2015 The International Internet Preservation Consortium. All Rights Reserved.