Class ARCRecordMetaData
java.lang.Object
org.archive.io.arc.ARCRecordMetaData
- All Implemented Interfaces:
ArchiveRecordHeader
An immutable class to hold an ARC record meta data.
- Author:
- stack
-
Field Summary
FieldsModifier and TypeFieldDescriptionMap of record header fields. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedShut down the default constructor.ARCRecordMetaData(String arc, Map<String, Object> headerFields) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiongetArc()intOffset at which the content begins.longgetDate()Get the time when the record was harvested.getHeaderValue(String key) getIp()longlonggetUrl()protected voidsetContentBegin(int offset) voidvoidsetStatusCode(String statusCode) protected voidtestRequiredField(Map<String, Object> fields, String requiredField) Test required field is present in hash.toString()
-
Field Details
-
headerFields
-
-
Constructor Details
-
ARCRecordMetaData
protected ARCRecordMetaData()Shut down the default constructor. -
ARCRecordMetaData
Constructor.- Parameters:
arc- The arc file this metadata came out of.headerFields- Hash of meta fields.- Throws:
IOException
-
-
Method Details
-
testRequiredField
protected void testRequiredField(Map<String, Object> fields, String requiredField) throws IOExceptionTest required field is present in hash.- Parameters:
fields- Map of fields.requiredField- Field to test for.- Throws:
IOException- If required field is not present.
-
getDate
Get the time when the record was harvested.Returns the date in Heritrix 14 digit time format (UTC). See the
ArchiveUtilsclass for converting to Java dates.- Specified by:
getDatein interfaceArchiveRecordHeader- Returns:
- Header date in Heritrix 14 digit format.
- See Also:
-
getLength
public long getLength()- Specified by:
getLengthin interfaceArchiveRecordHeader- Returns:
- Return length of the record.
-
getContentLength
public long getContentLength()- Specified by:
getContentLengthin interfaceArchiveRecordHeader- Returns:
- Return Content-Length of the contents of the record Same as record length for arcs? TODO
-
getUrl
- Specified by:
getUrlin interfaceArchiveRecordHeader- Returns:
- Header url.
-
getIp
- Returns:
- IP.
-
getMimetype
- Specified by:
getMimetypein interfaceArchiveRecordHeader- Returns:
- mimetype The mimetype that is in the ARC metaline -- NOT the http content-type content.
-
getVersion
- Specified by:
getVersionin interfaceArchiveRecordHeader- Returns:
- Arcfile version.
-
getOrigin
- Returns:
- Arcfile origin code.
-
getOffset
public long getOffset()- Specified by:
getOffsetin interfaceArchiveRecordHeader- Returns:
- Offset into arcfile at which this record begins.
-
getHeaderValue
- Specified by:
getHeaderValuein interfaceArchiveRecordHeader- Parameters:
key- Key to use looking up field value.- Returns:
- value for passed key of null if no such entry.
-
getHeaderFieldKeys
- Specified by:
getHeaderFieldKeysin interfaceArchiveRecordHeader- Returns:
- Header field name keys.
-
getHeaderFields
- Specified by:
getHeaderFieldsin interfaceArchiveRecordHeader- Returns:
- Map of header fields.
-
getArc
- Returns:
- Returns identifier for ARC.
-
getArcFile
- Returns:
- Convenience method that does a return new File(this.arc) (Be aware this.arc is not always full path to an ARC file -- may be an URL). Test returned file for existence.
-
getDigest
- Specified by:
getDigestin interfaceArchiveRecordHeader- Returns:
- Returns the digest.
-
setDigest
- Parameters:
d- The digest to set.
-
getStatusCode
- Returns:
- Returns the statusCode. May be null.
-
setStatusCode
- Parameters:
statusCode- The statusCode to set.
-
toString
- Specified by:
toStringin interfaceArchiveRecordHeader- Overrides:
toStringin classObject
-
getReaderIdentifier
- Specified by:
getReaderIdentifierin interfaceArchiveRecordHeader- Returns:
- Returns identifier for current Archive file. Be aware this may not be a file name or file path. It may just be an URL. Depends on how Archive file was made.
-
getRecordIdentifier
- Specified by:
getRecordIdentifierin interfaceArchiveRecordHeader- Returns:
- Identifier for the record. If ARC, the URL + date. If WARC, the GUID assigned.
-
getContentBegin
public int getContentBegin()Description copied from interface:ArchiveRecordHeaderOffset at which the content begins. For ARCs, its used to delimit where http headers end and content begins. For WARCs, its end of Named Fields before payload starts.- Specified by:
getContentBeginin interfaceArchiveRecordHeader
-
setContentBegin
protected void setContentBegin(int offset)
-