public class ArchiveReaderFactory extends 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, 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(HttpURLConnection connection) |
static ArchiveReader |
get(File f) |
static ArchiveReader |
get(File f,
long offset) |
static ArchiveReader |
get(String arcFileOrUrl)
Get an Archive file Reader on passed path or url.
|
static ArchiveReader |
get(String s,
InputStream is,
boolean atFirstRecord)
Wrap a Reader around passed Stream.
|
static ArchiveReader |
get(URL u)
Get an ARCReader.
|
static ArchiveReader |
get(URL u,
long offset)
Get an Archive Reader aligned at
offset. |
protected ArchiveReader |
getArchiveReader(File f) |
protected ArchiveReader |
getArchiveReader(File f,
long offset) |
protected ArchiveReader |
getArchiveReader(String arcFileOrUrl) |
protected ArchiveReader |
getArchiveReader(String id,
InputStream is,
boolean atFirstRecord) |
protected ArchiveReader |
getArchiveReader(String arcFileOrUrl,
long offset) |
protected ArchiveReader |
getArchiveReader(URL u) |
protected ArchiveReader |
getArchiveReader(URL f,
long offset) |
protected boolean |
isCompressed(File f) |
protected ArchiveReader |
makeARCLocal(URLConnection connection) |
protected ArchiveReaderFactory()
public static ArchiveReader get(String arcFileOrUrl) throws MalformedURLException, IOException
arcFileOrUrl - File path or URL pointing at an Archive file.IOExceptionMalformedURLExceptionIOExceptionprotected ArchiveReader getArchiveReader(String arcFileOrUrl) throws MalformedURLException, IOException
MalformedURLExceptionIOExceptionprotected ArchiveReader getArchiveReader(String arcFileOrUrl, long offset) throws MalformedURLException, IOException
MalformedURLExceptionIOExceptionpublic static ArchiveReader get(File f) throws IOException
f - An Archive file to read.IOExceptionprotected ArchiveReader getArchiveReader(File f) throws IOException
IOExceptionpublic static ArchiveReader get(File f, long offset) throws IOException
f - An Archive file to read.offset - Have returned Reader set to start reading at this offset.IOExceptionprotected ArchiveReader getArchiveReader(File f, long offset) throws IOException
IOExceptionpublic static ArchiveReader get(String s, InputStream is, boolean atFirstRecord) throws 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?IOExceptionprotected ArchiveReader getArchiveReader(String id, InputStream is, boolean atFirstRecord) throws IOException
IOExceptionpublic static ArchiveReader get(URL u, long offset) throws 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.IOExceptionprotected ArchiveReader getArchiveReader(URL f, long offset) throws IOException
IOExceptionpublic static ArchiveReader get(URL u) throws 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.IOExceptionprotected ArchiveReader getArchiveReader(URL u) throws IOException
IOExceptionprotected ArchiveReader makeARCLocal(URLConnection connection) throws IOException
IOExceptionprotected void addUserAgent(HttpURLConnection connection)
protected boolean isCompressed(File f) throws IOException
f - File to test.f is compressed.IOExceptionCopyright © 2015 The International Internet Preservation Consortium. All Rights Reserved.