|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jwat.warc.WarcRecord
public class WarcRecord
This class represents a parsed WARC record header block including possible validation and format warnings/errors encountered in the process. The payload of the WARC record is accessible through a wrapped payload object.
| Field Summary | |
|---|---|
protected boolean |
bClosed
Has record been closed before. |
protected boolean |
bIsCompliant
Is this record compliant ie. error free. |
protected boolean |
bMisplacedCr
Did the reader detect a misplaced CR while parsing newlines. |
protected boolean |
bMisplacedLf
Did the reader detect a misplaced LF while parsing newlines. |
protected boolean |
bMissingCr
Did the reader detect a missing CR while parsing newlines. |
protected boolean |
bMissingLf
Did the reader detect a missing LF while parsing newlines. |
protected boolean |
bPayloadClosed
Has payload been closed before. |
WarcDigest |
computedBlockDigest
Computed block digest. |
WarcDigest |
computedPayloadDigest
Computed payload digest. |
Diagnostics<Diagnosis> |
diagnostics
Validation errors and warnings. |
WarcHeader |
header
WARC header. |
protected HttpHeader |
httpHeader
HTTP header content parsed from payload. |
protected ByteCountingPushBackInputStream |
in
Input stream used to read this record. |
Boolean |
isValidBlockDigest
Is Warc-Block-Digest valid. |
Boolean |
isValidPayloadDigest
Is Warc-Payload-Digest valid. |
protected Payload |
payload
Payload object if any exists. |
protected WarcReader |
reader
Reader instance used, required for file compliance. |
| Constructor Summary | |
|---|---|
protected |
WarcRecord()
Non public constructor to allow unit testing. |
| Method Summary | |
|---|---|
protected void |
addErrorDiagnosis(DiagnosisType type,
String entity,
String... information)
Add an error diagnosis of the given type on a specific entity with optional extra information. |
protected void |
addWarningDiagnosis(DiagnosisType type,
String entity,
String... information)
Add a warning diagnosis of the given type on a specific entity with optional extra information. |
void |
close()
Close resources associated with the WARC record. |
static WarcRecord |
createRecord(WarcWriter writer)
|
HeaderLine |
getHeader(String field)
Get a non-standard WARC header or null, if nothing is stored for this header name. |
List<HeaderLine> |
getHeaderList()
Get a List of all the non-standard WARC headers found
during parsing. |
Payload |
getPayload()
Return Payload object. |
InputStream |
getPayloadContent()
Payload content InputStream getter. |
long |
getStartOffset()
Get the record offset relative to the start of the WARC file InputStream. |
boolean |
hasPayload()
Specifies whether this record has a payload or not. |
boolean |
isClosed()
Check to see if the record has been closed. |
boolean |
isCompliant()
Returns a boolean indicating the ISO compliance status of this record. |
protected int |
parseNewLines(ByteCountingPushBackInputStream in)
Looks forward in the inputstream and counts the number of newlines found. |
static WarcRecord |
parseRecord(ByteCountingPushBackInputStream in,
WarcReader reader)
Given an InputStream it tries to read and validate a WARC
header block. |
void |
payloadClosed()
Called when the payload object is closed and final steps in the validation process can be performed. |
protected void |
processComputedDigest(WarcDigest computedDigest,
String digestAlgorithm,
String digestEncoding,
String digestName)
Adjust algorithm and encoding information about computed block digest. |
protected Boolean |
processWarcDigest(WarcDigest warcDigest,
WarcDigest computedDigest,
String digestName)
Auto-detect encoding used in WARC digest header and compare it to the internal one, if it has been computed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected WarcReader reader
protected ByteCountingPushBackInputStream in
protected boolean bIsCompliant
public final Diagnostics<Diagnosis> diagnostics
public Boolean isValidBlockDigest
public Boolean isValidPayloadDigest
public WarcHeader header
protected boolean bMissingCr
protected boolean bMissingLf
protected boolean bMisplacedCr
protected boolean bMisplacedLf
protected boolean bPayloadClosed
protected boolean bClosed
protected Payload payload
protected HttpHeader httpHeader
public WarcDigest computedBlockDigest
public WarcDigest computedPayloadDigest
| Constructor Detail |
|---|
protected WarcRecord()
| Method Detail |
|---|
public static WarcRecord createRecord(WarcWriter writer)
public static WarcRecord parseRecord(ByteCountingPushBackInputStream in,
WarcReader reader)
throws IOException
InputStream it tries to read and validate a WARC
header block.
in - InputStream containing WARC record datareader - WarcReader used, with access to user defined
options
WarcRecord or null
IOException - io exception in the process of reading record
public void payloadClosed()
throws IOException
payloadClosed in interface PayloadOnClosedHandlerIOException - io exception in final validation processingpublic boolean isClosed()
protected Boolean processWarcDigest(WarcDigest warcDigest,
WarcDigest computedDigest,
String digestName)
warcDigest - digest from WARC headercomputedDigest - internally compute digest
protected void processComputedDigest(WarcDigest computedDigest,
String digestAlgorithm,
String digestEncoding,
String digestName)
computedDigest - internally compute digestdigestAlgorithm - default algorithmdigestEncoding - default encoding
public void close()
throws IOException
IOException - if unable to close resourcespublic long getStartOffset()
InputStream.
public List<HeaderLine> getHeaderList()
List of all the non-standard WARC headers found
during parsing.
List of HeaderLinepublic HeaderLine getHeader(String field)
field - header name
public boolean hasPayload()
public Payload getPayload()
nullpublic InputStream getPayloadContent()
InputStream getter.
InputStreampublic boolean isCompliant()
protected void addErrorDiagnosis(DiagnosisType type,
String entity,
String... information)
type - diagnosis typeentity - entity examinedinformation - optional extra information
protected void addWarningDiagnosis(DiagnosisType type,
String entity,
String... information)
type - diagnosis typeentity - entity examinedinformation - optional extra information
protected int parseNewLines(ByteCountingPushBackInputStream in)
throws IOException
in - data inputstream
IOException - if an error occurs while reading data
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||