public abstract class ArcRecordBase extends java.lang.Object implements PayloadOnClosedHandler, java.io.Closeable
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
bClosed
Has record been closed flag.
|
protected boolean |
bHasPseudoEmptyPayload
Has all the payload data been processed while reading the record header.
|
protected boolean |
bIsCompliant
Is this record compliant ie.
|
protected boolean |
bPayloadClosed
Has payload been closed before.
|
Digest |
computedBlockDigest
Computed block digest.
|
Digest |
computedPayloadDigest
Computed payload digest.
|
protected long |
consumed
Uncompressed bytes consumed while validating this record.
|
Diagnostics<Diagnosis> |
diagnostics
Validation errors and warnings.
|
byte[] |
excessiveMetadata
This array is used to store metadata which should not be present.
|
ArcHeader |
header
ARC record header.
|
protected HttpHeader |
httpHeader
HTTP header content parsed from payload.
|
protected ByteCountingPushBackInputStream |
in
Input stream used to read this record.
|
NewlineParser |
nlp
Newline parser for counting/validating trailing newlines.
|
protected Payload |
payload
Payload object if any exists.
|
protected ArcReader |
reader
Reader instance used, required for file compliance.
|
int |
recordType
Record type, version block or arc record.
|
static int |
RT_ARC_RECORD
Arc record record type.
|
static int |
RT_VERSION_BLOCK
Version block record type.
|
protected long |
startOffset
ARC record parsing start offset relative to the source ARC file input
stream.
|
static int |
TOSTRING_BUFFER_SIZE
Buffer size used in toString().
|
int |
trailingNewLines
Number of trailing newlines after record.
|
protected ArcVersion |
version
ARC record version.
|
ArcVersionHeader |
versionHeader
ARC version header.
|
| Constructor and Description |
|---|
ArcRecordBase() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addErrorDiagnosis(DiagnosisType type,
java.lang.String entity,
java.lang.String... information)
Add an error diagnosis of the given type on a specific entity with
optional extra information.
|
void |
close()
Close resources associated with the ARC record.
|
java.util.Date |
getArchiveDate()
ArchiveDate getter.
|
java.lang.String |
getArchiveDateStr()
Raw ArchiveDate getter.
|
java.lang.Long |
getArchiveLength()
Length getter.
|
java.lang.String |
getArchiveLengthStr()
Raw Length getter.
|
java.lang.String |
getChecksum()
Checksum getter.
|
long |
getConsumed()
Return number of uncompressed bytes consumed validating this record.
|
ContentType |
getContentType()
Content-Type getter.
|
java.lang.String |
getContentTypeStr()
Raw Content-Type getter.
|
java.lang.String |
getFileName()
FileName getter.
|
HttpHeader |
getHttpHeader()
Returns the
HttpHeader object if identified in the payload,
or null. |
java.net.InetAddress |
getInetAddress()
inetAddress getter. |
java.lang.String |
getIpAddress()
IpAddress getter.
|
java.lang.String |
getLocation()
Location getter.
|
java.lang.Long |
getOffset()
Offset getter.
|
java.lang.String |
getOffsetStr()
Raw Offset getter.
|
Payload |
getPayload()
Return Payload object.
|
java.io.InputStream |
getPayloadContent()
Payload content
InputStream getter. |
java.lang.Integer |
getResultCode()
Result-Code getter.
|
java.lang.String |
getResultCodeStr()
Raw Result-Code getter.
|
java.lang.String |
getScheme()
Protocol getter.
|
long |
getStartOffset()
Returns the parsing start offset of the record in the containing ARC.
|
Uri |
getUrl()
URL getter.
|
java.lang.String |
getUrlStr()
Raw URL getter.
|
ArcVersion |
getVersion()
Version getter.
|
boolean |
hasPayload()
Specifies whether this record has a payload or not.
|
boolean |
hasPseudoEmptyPayload()
Specifies whether this record has had all it's payload processed already.
|
boolean |
isClosed()
Check to see if the record has been closed.
|
boolean |
isCompliant()
Returns a boolean indicating the standard compliance of this record.
|
boolean |
isValidStreamOfCRLF(java.io.InputStream in)
Parses the remaining input stream and validates that the characters
encountered are equal to LF or CR.
|
static ArcRecordBase |
parseRecord(ByteCountingPushBackInputStream in,
ArcReader reader)
Reads from the input stream and tries to parse and identify an
ArcRecord or ArcVersionBlock record. |
void |
payloadClosed()
Called when the payload object is closed and final steps in the
validation process can be performed.
|
protected abstract void |
processPayload(ByteCountingPushBackInputStream in,
ArcReader reader)
Process the ARC record stream for possible payload data.
|
java.lang.String |
toString() |
public static final int RT_VERSION_BLOCK
public static final int RT_ARC_RECORD
public static final int TOSTRING_BUFFER_SIZE
protected boolean bIsCompliant
protected ByteCountingPushBackInputStream in
protected ArcVersion version
protected long startOffset
protected long consumed
public Diagnostics<Diagnosis> diagnostics
public NewlineParser nlp
public int recordType
public int trailingNewLines
public ArcVersionHeader versionHeader
protected boolean bPayloadClosed
protected boolean bClosed
protected boolean bHasPseudoEmptyPayload
protected HttpHeader httpHeader
public Digest computedBlockDigest
public Digest computedPayloadDigest
public byte[] excessiveMetadata
public ArcRecordBase()
public static ArcRecordBase parseRecord(ByteCountingPushBackInputStream in, ArcReader reader) throws java.io.IOException
ArcRecord or ArcVersionBlock record.in - input stream with ARC record datareader - ARC reader used with access to overall configuration and statusArcRecord, ArcVersionBlock or nulljava.io.IOException - I/O exception while parsing ARC record datapublic void payloadClosed() throws java.io.IOException
payloadClosed in interface PayloadOnClosedHandlerjava.io.IOException - I/O exception in final validation processingpublic boolean isClosed()
public void close() throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOException - I/O exception close the payload resourcespublic boolean isCompliant()
public long getStartOffset()
public long getConsumed()
protected abstract void processPayload(ByteCountingPushBackInputStream in, ArcReader reader) throws java.io.IOException
in - ARC record InputStreamreader - ArcReader used, with access to user defined
optionsjava.io.IOException - I/O exception in the parsing processpublic boolean hasPayload()
public boolean hasPseudoEmptyPayload()
public Payload getPayload()
nullpublic java.io.InputStream getPayloadContent()
InputStream getter.InputStreampublic HttpHeader getHttpHeader()
HttpHeader object if identified in the payload,
or null.HttpHeader object if identified or nullpublic boolean isValidStreamOfCRLF(java.io.InputStream in) throws java.io.IOException
in - InputStream to validatejava.io.IOException - I/O exception in parsingprotected void addErrorDiagnosis(DiagnosisType type, java.lang.String entity, java.lang.String... information)
type - diagnosis typeentity - entity examinedinformation - optional extra informationpublic ArcVersion getVersion()
public java.lang.String getUrlStr()
public java.lang.String getScheme()
public java.lang.String getIpAddress()
public java.net.InetAddress getInetAddress()
inetAddress getter.public java.lang.String getArchiveDateStr()
public java.util.Date getArchiveDate()
public java.lang.String getContentTypeStr()
public ContentType getContentType()
public java.lang.String getResultCodeStr()
public java.lang.Integer getResultCode()
public java.lang.String getChecksum()
public java.lang.String getLocation()
public java.lang.String getOffsetStr()
public java.lang.Long getOffset()
public java.lang.String getFileName()
public java.lang.String getArchiveLengthStr()
public java.lang.Long getArchiveLength()
public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2011–2022. All rights reserved.