Package it.unimi.dsi.law.warc.util
Class AbstractHttpResponse
java.lang.Object
it.unimi.dsi.law.warc.util.AbstractHttpResponse
- All Implemented Interfaces:
HttpResponse
,Response
- Direct Known Subclasses:
HttpComponentsHttpResponse
,MetadataHttpResponse
public abstract class AbstractHttpResponse extends Object implements HttpResponse
An abstract implementation of
HttpResponse
providing a toWarcRecord(WarcRecord)
method that can
be used to populate a WARC record (in order to write it).-
Field Summary
Fields Modifier and Type Field Description protected XorShift128PlusRandomGenerator
random
A high-quality pseudorandom generator to generate UUIDs.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 AbstractHttpResponse()
-
Method Summary
Modifier and Type Method Description void
toWarcRecord(WarcRecord record)
Populates a WARC record with contents from this response.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface it.unimi.dsi.law.warc.util.HttpResponse
contentAsStream, headers, status, statusLine
Methods inherited from interface it.unimi.dsi.law.warc.util.Response
fromWarcRecord, uri
-
Field Details
-
random
A high-quality pseudorandom generator to generate UUIDs.
-
-
Constructor Details
-
AbstractHttpResponse
public AbstractHttpResponse()
-
-
Method Details
-
toWarcRecord
Populates a WARC record with contents from this response.This method uses the getters of the
HttpResponse
interface to populate the given record. For this reason, concrete implementations of this class must provide an implementation forHttpResponse.contentAsStream()
that will be used to setup theWarcRecord.block
.Moreover, if the concrete implementation through which this method is called implements the
DigestBasedDuplicateDetection
interface, the WARC record will be also populated with the information required to represent the duplicate information.- Parameters:
record
- the record.- Throws:
UnsupportedEncodingException
IOException
-