java.io.Serializable
, java.lang.Cloneable
, org.apache.http.Header
, org.apache.http.NameValuePair
public class WarcHeader
extends org.apache.http.message.BasicHeader
Modifier and Type | Class | Description |
---|---|---|
static class |
WarcHeader.Name |
An enumeration of WARC headers.
|
Constructor | Description |
---|---|
WarcHeader(WarcHeader.Name name,
java.lang.String value) |
Creates a WARC header.
|
Modifier and Type | Method | Description |
---|---|---|
static void |
addIfNotPresent(org.apache.http.message.HeaderGroup headers,
WarcHeader.Name name,
java.lang.String value) |
Adds the given header, if not present (otherwise does nothing).
|
static java.lang.String |
formatDate(java.util.Calendar calendar) |
Formats the date to be written in the
WarcHeader.Name.WARC_DATE header. |
static java.lang.String |
formatId(java.util.UUID id) |
Formats the record id to be written in the
WarcHeader.Name.WARC_RECORD_ID header. |
static org.apache.http.Header |
getFirstHeader(org.apache.http.message.HeaderGroup headers,
WarcHeader.Name name) |
Returns the first header of given name.
|
static java.util.Date |
parseDate(java.lang.String date) |
Parses the date found in a
WarcHeader.Name.WARC_DATE header. |
static java.util.UUID |
parseId(java.lang.String id) |
Parses the date found in a
WarcHeader.Name.WARC_RECORD_ID header. |
public WarcHeader(WarcHeader.Name name, java.lang.String value)
name
- the header name.value
- the header value.public static void addIfNotPresent(org.apache.http.message.HeaderGroup headers, WarcHeader.Name name, java.lang.String value)
headers
- the headers where to add the new one.name
- the name of the header to add.value
- the value of the header to add.public static org.apache.http.Header getFirstHeader(org.apache.http.message.HeaderGroup headers, WarcHeader.Name name)
headers
- the headers to search from.name
- the name of the header to lookup.public static java.util.Date parseDate(java.lang.String date) throws WarcFormatException
WarcHeader.Name.WARC_DATE
header.date
- the date.WarcFormatException
public static java.lang.String formatDate(java.util.Calendar calendar)
WarcHeader.Name.WARC_DATE
header.calendar
- the date.public static java.util.UUID parseId(java.lang.String id) throws WarcFormatException
WarcHeader.Name.WARC_RECORD_ID
header.id
- the record id.WarcFormatException
public static java.lang.String formatId(java.util.UUID id)
WarcHeader.Name.WARC_RECORD_ID
header.id
- the record id.