public class ArchiveReaderFactory extends java.lang.Object implements ArchiveFileConstants
ABSOLUTE_OFFSET_KEY, CDX, CDX_FILE, CDX_LINE_BUFFER_SIZE, CRLF, DATE_FIELD_KEY, DEFAULT_DIGEST_METHOD, DOT_COMPRESSED_FILE_EXTENSION, DUMP, GZIP_DUMP, HEADER, INVALID_SUFFIX, LENGTH_FIELD_KEY, MIMETYPE_FIELD_KEY, NOHEAD, OCCUPIED_SUFFIX, ORIGIN_FIELD_KEY, READER_IDENTIFIER_FIELD_KEY, RECORD_IDENTIFIER_FIELD_KEY, SINGLE_SPACE, TYPE_FIELD_KEY, URL_FIELD_KEY, VERSION_FIELD_KEY| Modifier | Constructor and Description |
|---|---|
protected |
ArchiveReaderFactory()
Shutdown any public access to default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addUserAgent(java.net.HttpURLConnection connection) |
static ArchiveReader |
get(java.io.File f) |
static ArchiveReader |
get(java.io.File f,
long offset) |
static ArchiveReader |
get(java.lang.String arcFileOrUrl)
Get an Archive file Reader on passed path or url.
|
static ArchiveReader |
get(java.lang.String s,
java.io.InputStream is,
boolean atFirstRecord)
Wrap a Reader around passed Stream.
|
static ArchiveReader |
get(java.net.URL u)
Get an ARCReader.
|
static ArchiveReader |
get(java.net.URL u,
long offset)
Get an Archive Reader aligned at
offset. |
protected ArchiveReader |
getArchiveReader(java.io.File f) |
protected ArchiveReader |
getArchiveReader(java.io.File f,
long offset) |
protected ArchiveReader |
getArchiveReader(java.lang.String arcFileOrUrl) |
protected ArchiveReader |
getArchiveReader(java.lang.String id,
java.io.InputStream is,
boolean atFirstRecord) |
protected ArchiveReader |
getArchiveReader(java.lang.String arcFileOrUrl,
long offset) |
protected ArchiveReader |
getArchiveReader(java.net.URL u) |
protected ArchiveReader |
getArchiveReader(java.net.URL f,
long offset) |
protected boolean |
isCompressed(java.io.File f) |
protected ArchiveReader |
makeARCLocal(java.net.URLConnection connection) |
protected ArchiveReaderFactory()
public static ArchiveReader get(java.lang.String arcFileOrUrl) throws java.net.MalformedURLException, java.io.IOException
arcFileOrUrl - File path or URL pointing at an Archive file.java.io.IOExceptionjava.net.MalformedURLExceptionjava.io.IOExceptionprotected ArchiveReader getArchiveReader(java.lang.String arcFileOrUrl) throws java.net.MalformedURLException, java.io.IOException
java.net.MalformedURLExceptionjava.io.IOExceptionprotected ArchiveReader getArchiveReader(java.lang.String arcFileOrUrl, long offset) throws java.net.MalformedURLException, java.io.IOException
java.net.MalformedURLExceptionjava.io.IOExceptionpublic static ArchiveReader get(java.io.File f) throws java.io.IOException
f - An Archive file to read.java.io.IOExceptionprotected ArchiveReader getArchiveReader(java.io.File f) throws java.io.IOException
java.io.IOExceptionpublic static ArchiveReader get(java.io.File f, long offset) throws java.io.IOException
f - An Archive file to read.offset - Have returned Reader set to start reading at this offset.java.io.IOExceptionprotected ArchiveReader getArchiveReader(java.io.File f, long offset) throws java.io.IOException
java.io.IOExceptionpublic static ArchiveReader get(java.lang.String s, java.io.InputStream is, boolean atFirstRecord) throws java.io.IOException
s - Identifying String for this Stream used in error messages.
Must be a string that ends with the name of the file we're to put
an ArchiveReader on. This code looks at file endings to figure
whether to return an ARC or WARC reader.is - Stream. Stream will be wrapped with implementation of
RepositionableStream unless already supported.atFirstRecord - Are we at first Record?java.io.IOExceptionprotected ArchiveReader getArchiveReader(java.lang.String id, java.io.InputStream is, boolean atFirstRecord) throws java.io.IOException
java.io.IOExceptionpublic static ArchiveReader get(java.net.URL u, long offset) throws java.io.IOException
offset.
This version of get will not bring the file local but will try to
stream across the net making an HTTP 1.1 Range request on remote
http server (RFC1435 Section 14.35).u - HTTP URL for an Archive file.offset - Offset into file at which to start fetching.java.io.IOExceptionprotected ArchiveReader getArchiveReader(java.net.URL f, long offset) throws java.io.IOException
java.io.IOExceptionpublic static ArchiveReader get(java.net.URL u) throws java.io.IOException
java.io.tmpdir points. It then hands back an ARCReader that
points at this local copy. A close on this ARCReader instance will
remove the local copy.u - An URL that points at an ARC.java.io.IOExceptionprotected ArchiveReader getArchiveReader(java.net.URL u) throws java.io.IOException
java.io.IOExceptionprotected ArchiveReader makeARCLocal(java.net.URLConnection connection) throws java.io.IOException
java.io.IOExceptionprotected void addUserAgent(java.net.HttpURLConnection connection)
protected boolean isCompressed(java.io.File f)
throws java.io.IOException
f - File to test.f is compressed.java.io.IOExceptionCopyright © 2019 The International Internet Preservation Consortium. All Rights Reserved.