Package it.unimi.dsi.law.warc.util
Class WarcHttpResponse
java.lang.Object
it.unimi.dsi.law.warc.util.AbstractHttpResponse
it.unimi.dsi.law.warc.util.MetadataHttpResponse
it.unimi.dsi.law.warc.util.WarcHttpResponse
- All Implemented Interfaces:
DigestBasedDuplicateDetection
,HttpResponse
,Response
public class WarcHttpResponse extends MetadataHttpResponse implements DigestBasedDuplicateDetection
An
AbstractHttpResponse
implementation that reads the response
content from a WARC record (via the fromWarcRecord(WarcRecord)
method.-
Nested Class Summary
Nested classes/interfaces inherited from class it.unimi.dsi.law.warc.util.MetadataHttpResponse
MetadataHttpResponse.HeaderMap
-
Field Summary
Fields inherited from class it.unimi.dsi.law.warc.util.MetadataHttpResponse
headerMap, statusLine, uri
Fields inherited from class it.unimi.dsi.law.warc.util.AbstractHttpResponse
random
Fields inherited from interface it.unimi.dsi.law.warc.util.HttpResponse
DIGEST_HEADER, GUESSED_CHARSET_HEADER, HEADER_CHARSET, ISDUPLICATE_HEADER
-
Constructor Summary
Constructors Constructor Description WarcHttpResponse()
-
Method Summary
Modifier and Type Method Description MeasurableInputStream
contentAsStream()
Returns the content of this response as a stream.byte[]
digest()
Returns the content digest.boolean
fromWarcRecord(WarcRecord wr)
Fills this response with the content of aWarcRecord
(optional operation).Map<String,String>
headers()
Returns the headers of this response.boolean
isDuplicate()
Returns the duplicate status of this response.Methods inherited from class it.unimi.dsi.law.warc.util.MetadataHttpResponse
headers, status, statusLine, statusLine, uri, uri
Methods inherited from class it.unimi.dsi.law.warc.util.AbstractHttpResponse
toWarcRecord
-
Constructor Details
-
WarcHttpResponse
public WarcHttpResponse()
-
-
Method Details
-
headers
Description copied from interface:HttpResponse
Returns the headers of this response.Warning: as of LAW 3.0, and contrarily to previous behaviour, the map is case-sensitive. Use the predefined names in
HttpHeaders
orHttpHeaders
to avoid typing and casing mistakes.- Specified by:
headers
in interfaceHttpResponse
- Overrides:
headers
in classMetadataHttpResponse
- Returns:
- the headers of this response.
-
contentAsStream
Description copied from interface:HttpResponse
Returns the content of this response as a stream.- Specified by:
contentAsStream
in interfaceHttpResponse
- Returns:
- the content of this response as a stream.
-
fromWarcRecord
Description copied from interface:Response
Fills this response with the content of aWarcRecord
(optional operation).- Specified by:
fromWarcRecord
in interfaceResponse
- Parameters:
wr
- the record.- Returns:
- true iff the
record-type
of the given record isresponse
. - Throws:
IOException
-
digest
public byte[] digest()Description copied from interface:DigestBasedDuplicateDetection
Returns the content digest.- Specified by:
digest
in interfaceDigestBasedDuplicateDetection
- Returns:
- the digest.
-
isDuplicate
public boolean isDuplicate()Description copied from interface:DigestBasedDuplicateDetection
Returns the duplicate status of this response.- Specified by:
isDuplicate
in interfaceDigestBasedDuplicateDetection
- Returns:
- whether this response is a duplicate.
-