public class WarcWriter extends Object implements Closeable
| Constructor and Description |
|---|
WarcWriter(OutputStream stream) |
WarcWriter(Path path)
Opens a WARC file for writing.
|
WarcWriter(WritableByteChannel channel) |
WarcWriter(WritableByteChannel channel,
WarcCompression compression) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the channel.
|
FetchResult |
fetch(URI uri)
Downloads a remote resource recording the request and response as WARC records.
|
FetchResult |
fetch(URI uri,
FetchOptions options)
Downloads a remote resource recording the request and response as WARC records.
|
FetchResult |
fetch(URI uri,
HttpRequest httpRequest,
FetchOptions options)
Downloads a remote resource recording the request and response as WARC records.
|
FetchResult |
fetch(URI uri,
HttpRequest httpRequest,
OutputStream copyTo)
Downloads a remote resource recording the request and response as WARC records.
|
long |
position()
Returns the byte position the next record will be written to.
|
void |
write(WarcRecord record) |
public WarcWriter(WritableByteChannel channel, WarcCompression compression) throws IOException
IOExceptionpublic WarcWriter(WritableByteChannel channel) throws IOException
IOExceptionpublic WarcWriter(OutputStream stream) throws IOException
IOExceptionpublic WarcWriter(Path path) throws IOException
path - the path to the fileIOException - if an I/O error occurspublic void write(WarcRecord record) throws IOException
IOExceptionpublic FetchResult fetch(URI uri) throws IOException
IOExceptionpublic FetchResult fetch(URI uri, FetchOptions options) throws IOException
uri - URL to downloadoptions - fetch options to useIOException - if an IO error occurredpublic FetchResult fetch(URI uri, HttpRequest httpRequest, OutputStream copyTo) throws IOException
uri - URL to downloadhttpRequest - request to sendcopyTo - if not null will receive a copy of the (raw) http response bytesIOException - if an IO error occurredpublic FetchResult fetch(URI uri, HttpRequest httpRequest, FetchOptions options) throws IOException
uri - URL to downloadhttpRequest - request to sendoptions - fetch options to useIOException - if an IO error occurredpublic long position()
If the underlying channel is not seekable the returned value will be relative to the position the channel was in when the WarcWriter was created.
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2023. All rights reserved.