|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jwat.warc.WarcReader
public abstract class WarcReader
Base class for WARC reader implementations.
| Field Summary | |
|---|---|
protected boolean |
bBlockDigest
Block Digest enabled/disabled. |
protected boolean |
bIsCompliant
Compliance status for records parsed up to now. |
protected String |
blockDigestAlgorithm
Default block digest algorithm to use if none is present in the record. |
protected String |
blockDigestEncoding
Default encoding scheme used to encode block digest into a string, if none is detected from the record. |
protected boolean |
bPayloadDigest
Payload Digest enabled/disabled. |
protected long |
consumed
Number of bytes consumed by this reader. |
Diagnostics<Diagnosis> |
diagnostics
Reader level errors and warnings or when no record is available. |
protected int |
errors
Aggregated number of errors encountered while parsing. |
protected WarcFieldParsers |
fieldParser
WARC field parser used. |
protected HeaderLineReader |
headerLineReader
Header line reader used to read the WARC headers. |
protected Exception |
iteratorExceptionThrown
Exception thrown while using the iterator. |
protected HeaderLineReader |
lineReader
Line reader used to read version lines. |
protected String |
payloadDigestAlgorithm
Default payload digest algorithm to use if none is present in the record. |
protected String |
payloadDigestEncoding
Default encoding scheme used to encode payload digest into a string, if none is detected from the record. |
protected int |
payloadHeaderMaxSize
Max size allowed for a payload header. |
protected int |
warcHeaderMaxSize
Max size allowed for a WARC header. |
protected WarcRecord |
warcRecord
Current WARC record object. |
protected int |
warnings
Aggregate number of warnings encountered while parsing. |
| Constructor Summary | |
|---|---|
WarcReader()
|
|
| Method Summary | |
|---|---|
abstract void |
close()
Close current record resource(s) and input stream(s). |
String |
getBlockDigestAlgorithm()
Get the default block digest algorithm. |
boolean |
getBlockDigestEnabled()
Get the readers block digest on/off status. |
String |
getBlockDigestEncoding()
Get the default block digest encoding scheme. |
abstract long |
getConsumed()
Get number of bytes consumed by this reader. |
Exception |
getIteratorExceptionThrown()
Gets an exception thrown in the iterator if any or null. |
abstract WarcRecord |
getNextRecord()
Parses and gets the next record. |
abstract WarcRecord |
getNextRecordFrom(InputStream in,
long offset)
Parses and gets the next record from an Inputstream. |
abstract WarcRecord |
getNextRecordFrom(InputStream in,
long offset,
int buffer_size)
Parses and gets the next record from an Inputstream wrapped
by a BufferedInputStream. |
abstract long |
getOffset()
Get the current offset in the WARC InputStream. |
String |
getPayloadDigestAlgorithm()
Get the default payload digest algorithm. |
boolean |
getPayloadDigestEnabled()
Get the readers payload digest on/off status. |
String |
getPayloadDigestEncoding()
Get the default payload digest encoding scheme. |
int |
getPayloadHeaderMaxSize()
Get the max size allowed for a payload header. |
abstract long |
getStartOffset()
Get the offset of the current or next WARC record. |
int |
getWarcHeaderMaxSize()
Get the max size allowed for a WARC header. |
protected void |
init()
Method used to initialize a readers internal state. |
boolean |
isCompliant()
Returns a boolean indicating if all records parsed so far are compliant. |
abstract boolean |
isCompressed()
Is this reader assuming GZip compressed input. |
Iterator<WarcRecord> |
iterator()
Returns an Iterator over the records as they are being
parsed. |
boolean |
setBlockDigestAlgorithm(String digestAlgorithm)
Set the default block digest algorithm. |
void |
setBlockDigestEnabled(boolean enabled)
Set the readers block digest on/off status. |
void |
setBlockDigestEncoding(String encodingScheme)
Set the default block digest encoding scheme. |
boolean |
setPayloadDigestAlgorithm(String digestAlgorithm)
Set the default payload digest algorithm. |
void |
setPayloadDigestEnabled(boolean enabled)
Set the readers payload digest on/off status. |
void |
setPayloadDigestEncoding(String encodingScheme)
Set the default payload digest encoding scheme. |
void |
setPayloadHeaderMaxSize(int size)
Set the max size allowed for a payload header. |
void |
setWarcHeaderMaxSize(int size)
Set the max size allowed for a WARC header. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean bIsCompliant
protected long consumed
protected int errors
protected int warnings
protected boolean bBlockDigest
protected String blockDigestAlgorithm
protected String blockDigestEncoding
protected boolean bPayloadDigest
protected String payloadDigestAlgorithm
protected String payloadDigestEncoding
protected WarcRecord warcRecord
protected Exception iteratorExceptionThrown
protected int warcHeaderMaxSize
protected int payloadHeaderMaxSize
protected HeaderLineReader lineReader
protected HeaderLineReader headerLineReader
protected WarcFieldParsers fieldParser
public final Diagnostics<Diagnosis> diagnostics
| Constructor Detail |
|---|
public WarcReader()
| Method Detail |
|---|
protected void init()
public boolean isCompliant()
public abstract boolean isCompressed()
public boolean getBlockDigestEnabled()
public void setBlockDigestEnabled(boolean enabled)
enabled - boolean indicating block digest on/offpublic boolean getPayloadDigestEnabled()
public void setPayloadDigestEnabled(boolean enabled)
enabled - boolean indicating payload digest on/offpublic String getBlockDigestAlgorithm()
public boolean setBlockDigestAlgorithm(String digestAlgorithm)
digestAlgorithm - block digest algorithm
(null means default block digest is disabled)public String getPayloadDigestAlgorithm()
public boolean setPayloadDigestAlgorithm(String digestAlgorithm)
digestAlgorithm - payload digest algorithm
(null means default payload digest is disabled)public String getBlockDigestEncoding()
public void setBlockDigestEncoding(String encodingScheme)
encodingScheme - encoding scheme
(null means default block digest is not encoded)public String getPayloadDigestEncoding()
public void setPayloadDigestEncoding(String encodingScheme)
encodingScheme - encoding scheme
(null means default payload digest is not encoded)public int getWarcHeaderMaxSize()
public void setWarcHeaderMaxSize(int size)
size - max size allowedpublic int getPayloadHeaderMaxSize()
public void setPayloadHeaderMaxSize(int size)
size - max size allowedpublic abstract void close()
public abstract long getStartOffset()
public abstract long getOffset()
InputStream.
InputStreamWarcRecordBase#getStartOffset()public abstract long getConsumed()
public abstract WarcRecord getNextRecord()
throws IOException
IOException - io exception in parsing process
public abstract WarcRecord getNextRecordFrom(InputStream in,
long offset)
throws IOException
Inputstream.
This method is mainly for random access use since there are serious
side-effects involved in using multiple PushBackInputStream
instances.
in - InputStream used to read next recordoffset - offset provided by caller
IOException - io exception in parsing process
public abstract WarcRecord getNextRecordFrom(InputStream in,
long offset,
int buffer_size)
throws IOException
Inputstream wrapped
by a BufferedInputStream.
This method is mainly for random access use since there are serious
side-effects involved in using multiple PushBackInputStream
instances.
in - InputStream used to read next recordoffset - offset provided by callerbuffer_size - buffer size to use
IOException - io exception in parsing processpublic Exception getIteratorExceptionThrown()
public Iterator<WarcRecord> iterator()
Iterator over the records as they are being
parsed. Any exception thrown during parsing is accessible through the
getIteratorExceptionThrown method.
Iterator over the records
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||