Package org.microproxy.warc
Class WarcWriter
java.lang.Object
org.microproxy.warc.WarcWriter
- All Implemented Interfaces:
Closeable,AutoCloseable
Appends WARC 1.1 records to files in a directory, starting a new file (each opened by a
warcinfo record) when one reaches its size limit. A file is named
prefix-timestamp-serial.warc.gz and carries an extra .open suffix while it is being
written. Each record is its own gzip member, so readers can seek to any record. Thread-safe;
records passed to one write(java.util.List<org.microproxy.warc.WarcWriter.Record>) call stay together.-
Constructor Summary
ConstructorsConstructorDescriptionWarcWriter(Path dir, String prefix, long maxFileSize, boolean gzip, String software) Creates a WARC writer with file rotation and optional compression. -
Method Summary
-
Constructor Details
-
WarcWriter
public WarcWriter(Path dir, String prefix, long maxFileSize, boolean gzip, String software) throws IOException Creates a WARC writer with file rotation and optional compression.- Parameters:
dir- the directory in which to create WARC filesprefix- the WARC file-name prefixmaxFileSize- start a new file once the current one reaches this many bytesgzip- compress each record (.warc.gz); otherwise plain.warcsoftware- the software identification written to warcinfo records- Throws:
IOException- if the output directory cannot be created
-
-
Method Details
-
close
Finishes the current file. Later writes fail.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-