|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jwat.warc.WarcWriter
public abstract class WarcWriter
Base class for WARC writer implementations.
| Field Summary | |
|---|---|
protected boolean |
bExceptionOnContentLengthMismatch
Configuration for throwing exception on content-length mismatch. |
Diagnostics<Diagnosis> |
diagnostics
Writer level errors and warnings or when writing byte headers. |
protected WarcFieldParsers |
fieldParser
WARC field parser used. |
protected WarcHeader |
header
Current WARC header written. |
protected Long |
headerContentLength
Content-Length from the WARC header. |
protected OutputStream |
out
Outputstream used to write WARC records. |
protected long |
payloadWrittenTotal
Total bytes written for current record payload. |
protected static int |
S_HEADER_WRITTEN
State after header has been written. |
protected static int |
S_INIT
State after writer has been constructed and before records have been written. |
protected static int |
S_PAYLOAD_WRITTEN
State after payload has been written. |
protected static int |
S_RECORD_CLOSED
State after record has been closed. |
protected int |
state
Current state of writer. |
protected byte[] |
stream_copy_buffer
Buffer used by streamPayload() to copy from one stream to another. |
protected DateFormat |
warcDateFormat
WARC DateFormat as specified by the WARC ISO standard. |
| Constructor Summary | |
|---|---|
WarcWriter()
|
|
| Method Summary | |
|---|---|
abstract void |
close()
Close WARC writer and free its resources. |
protected void |
closeRecord_impl()
Close the WARC record by writing two newlines. |
abstract void |
closeRecord()
Close the WARC record. |
boolean |
exceptionOnContentLengthMismatch()
Does this writer throw an exception if the content-length does not match the payload amount written. |
protected void |
init()
Method used to initialize a readers internal state. |
abstract boolean |
isCompressed()
Is this writer producing compressed output. |
void |
setExceptionOnContentLengthMismatch(boolean enabled)
Tell the writer what to do in case of mismatch between content-length and amount payload written. |
long |
streamPayload(InputStream in)
|
protected byte[] |
writeHeader_impl(WarcRecord record)
Write a WARC header to the WARC output stream. |
void |
writeHeader(byte[] header_bytes,
Long contentLength)
Write a raw WARC header to the WARC output stream. |
abstract byte[] |
writeHeader(WarcRecord record)
Write a WARC header to the WARC output stream. |
long |
writePayload(byte[] b)
|
long |
writePayload(byte[] b,
int offset,
int len)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int S_INIT
protected static final int S_HEADER_WRITTEN
protected static final int S_PAYLOAD_WRITTEN
protected static final int S_RECORD_CLOSED
protected DateFormat warcDateFormat
DateFormat as specified by the WARC ISO standard.
protected WarcFieldParsers fieldParser
protected byte[] stream_copy_buffer
protected boolean bExceptionOnContentLengthMismatch
public final Diagnostics<Diagnosis> diagnostics
protected int state
protected OutputStream out
protected WarcHeader header
protected Long headerContentLength
protected long payloadWrittenTotal
| Constructor Detail |
|---|
public WarcWriter()
| Method Detail |
|---|
protected void init()
public abstract boolean isCompressed()
public boolean exceptionOnContentLengthMismatch()
public void setExceptionOnContentLengthMismatch(boolean enabled)
enabled - boolean indicating exception throwing on/offpublic abstract void close()
public abstract void closeRecord()
throws IOException
IOException - if an exception occurs while closing the record
protected void closeRecord_impl()
throws IOException
IOException - if an exception occurs while closing the record
public void writeHeader(byte[] header_bytes,
Long contentLength)
throws IOException
header_bytes - raw WARC record to output
IOException - if an exception occurs while writing header data
public abstract byte[] writeHeader(WarcRecord record)
throws IOException
record - WARC record to output
IOException - if an exception occurs while writing header data
protected byte[] writeHeader_impl(WarcRecord record)
throws IOException
record - WARC record to output
IOException - if an exception occurs while writing header data
public long streamPayload(InputStream in)
throws IOException
in - input stream containing payload data
IOException - if an exception occurs while writing payload data
public long writePayload(byte[] b)
throws IOException
IOException
public long writePayload(byte[] b,
int offset,
int len)
throws IOException
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||