|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream org.archive.io.ArchiveRecord
public abstract class ArchiveRecord
Archive file Record.
Field Summary | |
---|---|
protected MessageDigest |
digest
Compute digest on what we read and add to metadata when done. |
protected static long |
MIN_HTTP_HEADER_LENGTH
Minimal http response or request header length. |
Constructor Summary | |
---|---|
ArchiveRecord(InputStream in)
Constructor. |
|
ArchiveRecord(InputStream in,
ArchiveRecordHeader header)
Constructor. |
|
ArchiveRecord(InputStream in,
ArchiveRecordHeader header,
int bodyOffset,
boolean digest,
boolean strict)
Constructor. |
Method Summary | |
---|---|
int |
available()
This available is not the stream's available. |
void |
close()
Calling close on a record skips us past this record to the next record in the stream. |
void |
dump()
Writes output on STDOUT. |
void |
dump(OutputStream os)
Writes output on passed os . |
protected String |
getDigest4Cdx(ArchiveRecordHeader h)
|
String |
getDigestStr()
|
ArchiveRecordHeader |
getHeader()
|
protected InputStream |
getIn()
|
protected String |
getIp4Cdx(ArchiveRecordHeader h)
|
protected String |
getMimetype4Cdx(ArchiveRecordHeader h)
|
protected long |
getPosition()
|
protected String |
getStatusCode4Cdx(ArchiveRecordHeader h)
|
boolean |
hasContentHeaders()
Is it likely that this record contains headers? This method will return true if the body is a http response that includes http response headers or the body is a http request that includes request headers, etc. |
protected void |
incrementPosition()
|
protected void |
incrementPosition(long incr)
|
protected boolean |
isEor()
|
boolean |
isStrict()
|
boolean |
markSupported()
|
protected String |
outputCdx(String strippedFileName)
|
int |
read()
|
int |
read(byte[] b,
int offset,
int length)
|
protected void |
setBodyOffset(int bodyOffset)
|
protected void |
setEor(boolean eor)
|
protected void |
setHeader(ArchiveRecordHeader header)
|
void |
setStrict(boolean strict)
|
long |
skip(long n)
|
Methods inherited from class java.io.InputStream |
---|
mark, read, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final long MIN_HTTP_HEADER_LENGTH
protected MessageDigest digest
Protected instead of private so subclasses can update and complete the digest.
Constructor Detail |
---|
public ArchiveRecord(InputStream in) throws IOException
in
- Stream cue'd up to be at the start of the record this instance
is to represent.
IOException
public ArchiveRecord(InputStream in, ArchiveRecordHeader header) throws IOException
in
- Stream cue'd up to be at the start of the record this instance
is to represent.header
- Header data.
IOException
public ArchiveRecord(InputStream in, ArchiveRecordHeader header, int bodyOffset, boolean digest, boolean strict) throws IOException
in
- Stream cue'd up to be at the start of the record this instance
is to represent.header
- Header data.bodyOffset
- Offset into the body. Usually 0.digest
- True if we're to calculate digest for this record. Not
digesting saves about ~15% of cpu during an ARC parse.strict
- Be strict parsing (Parsing stops if ARC inproperly
formatted).
IOException
Method Detail |
---|
public boolean markSupported()
markSupported
in class InputStream
public ArchiveRecordHeader getHeader()
protected void setHeader(ArchiveRecordHeader header)
public void close() throws IOException
close
in interface Closeable
close
in class InputStream
IOException
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int offset, int length) throws IOException
read
in class InputStream
IOException
public int available()
available
in class InputStream
public long skip(long n) throws IOException
skip
in class InputStream
IOException
public boolean isStrict()
public void setStrict(boolean strict)
strict
- The strict to set.protected InputStream getIn()
public String getDigestStr()
protected void incrementPosition()
protected void incrementPosition(long incr)
protected long getPosition()
protected boolean isEor()
protected void setEor(boolean eor)
protected String getStatusCode4Cdx(ArchiveRecordHeader h)
protected String getIp4Cdx(ArchiveRecordHeader h)
protected String getDigest4Cdx(ArchiveRecordHeader h)
protected String getMimetype4Cdx(ArchiveRecordHeader h)
protected String outputCdx(String strippedFileName) throws IOException
IOException
public void dump() throws IOException
IOException
public void dump(OutputStream os) throws IOException
os
.
IOException
public boolean hasContentHeaders()
ArchiveRecordHeader
'headers'.
protected void setBodyOffset(int bodyOffset)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |