| java.lang.Object java.io.InputStream org.archive.io.ArchiveRecord
All known Subclasses: org.archive.io.warc.WARCRecord, org.archive.io.arc.ARCRecord, org.archive.io.warc.v10.WARCRecord,
ArchiveRecord | abstract public class ArchiveRecord extends InputStream (Code) | | Archive file Record.
author: stack version: $Date: 2006-09-22 17:23:04 +0000 (Fri, 22 Sep 2006) $ $Version$ |
Field Summary | |
protected MessageDigest | digest Compute digest on what we read and add to metadata when done.
Currently hardcoded as sha-1. | boolean | eor Set flag when we've reached the end-of-record. | ArchiveRecordHeader | header | InputStream | in Stream to read this record from.
Stream can only be read sequentially. | long | position Position w/i the Record content, within in .
This position is relative within this Record. | boolean | strict |
digest | protected MessageDigest digest(Code) | | Compute digest on what we read and add to metadata when done.
Currently hardcoded as sha-1. TODO: Remove when archive records
digest or else, add a facility that allows the arc reader to
compare the calculated digest to that which is recorded in
the arc.
Protected instead of private so subclasses can update and complete
the digest.
|
eor | boolean eor(Code) | | Set flag when we've reached the end-of-record.
|
in | InputStream in(Code) | | Stream to read this record from.
Stream can only be read sequentially. Will only return this records'
content returning a -1 if you try to read beyond the end of the current
record.
Streams can be markable or not. If they are, we'll be able to roll
back when we've read too far. If not markable, assumption is that
the underlying stream is managing our not reading too much (This pertains
to the skipping over the end of the ARCRecord. See
ArchiveRecord.skip() .
|
position | long position(Code) | | Position w/i the Record content, within in .
This position is relative within this Record. Its not same as the
Archive file position.
|
ArchiveRecord | public ArchiveRecord(InputStream in) throws IOException(Code) | | Constructor.
Parameters: in - Stream cue'd up to be at the start of the record this instanceis to represent. throws: IOException - |
ArchiveRecord | public ArchiveRecord(InputStream in, ArchiveRecordHeader header, int bodyOffset, boolean digest, boolean strict) throws IOException(Code) | | Constructor.
Parameters: in - Stream cue'd up to be at the start of the record this instanceis to represent. Parameters: header - Header data. Parameters: bodyOffset - Offset into the body. Usually 0. Parameters: digest - True if we're to calculate digest for this record. Notdigesting saves about ~15% of cpu during an ARC parse. Parameters: strict - Be strict parsing (Parsing stops if ARC inproperlyformatted). throws: IOException - |
available | public int available()(Code) | | This available is not the stream's available. Its an available based on
what the stated Archive record length is minus what we've read to date.
True if bytes remaining in record content. |
close | public void close() throws IOException(Code) | | Calling close on a record skips us past this record to the next record
in the stream.
It does not actually close the stream. The underlying steam is probably
being used by the next arc record.
throws: IOException - |
getPosition | protected long getPosition()(Code) | | |
incrementPosition | protected void incrementPosition()(Code) | | |
incrementPosition | protected void incrementPosition(long incr)(Code) | | |
isEor | protected boolean isEor()(Code) | | |
isStrict | public boolean isStrict()(Code) | | Returns the strict. |
markSupported | public boolean markSupported()(Code) | | |
setEor | protected void setEor(boolean eor)(Code) | | |
setStrict | public void setStrict(boolean strict)(Code) | | Parameters: strict - The strict to set. |
|
|