|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.archive.io.ArchiveReaderFactory org.archive.io.arc.ARCReaderFactory
public class ARCReaderFactory
Factory that returns an ARCReader. Can handle compressed and uncompressed ARCs.
Nested Class Summary | |
---|---|
class |
ARCReaderFactory.CompressedARCReader
Compressed arc file reader. |
class |
ARCReaderFactory.UncompressedARCReader
Uncompressed arc file reader. |
Field Summary |
---|
Fields inherited from interface org.archive.io.ArchiveFileConstants |
---|
ABSOLUTE_OFFSET_KEY, CDX, CDX_FILE, CDX_LINE_BUFFER_SIZE, COMPRESSED_FILE_EXTENSION, CRLF, DATE_FIELD_KEY, DEFAULT_DIGEST_METHOD, 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 |
Constructor Summary | |
---|---|
protected |
ARCReaderFactory()
Shutdown any access to default constructor. |
Method Summary | |
---|---|
static ARCReader |
get(java.io.File f)
|
static ARCReader |
get(java.io.File f,
boolean skipSuffixTest,
long offset)
|
static ARCReader |
get(java.io.File f,
long offset)
|
static ARCReader |
get(java.lang.String arcFileOrUrl)
|
static ArchiveReader |
get(java.lang.String s,
java.io.InputStream is,
boolean atFirstRecord)
|
static ARCReader |
get(java.lang.String arcFileOrUrl,
long offset)
|
static ARCReader |
get(java.net.URL arcUrl)
Get an ARCReader. |
static ARCReader |
get(java.net.URL arcUrl,
long offset)
Get an ARCReader aligned at offset . |
protected ArchiveReader |
getArchiveReader(java.io.File arcFile,
boolean skipSuffixTest,
long offset)
|
protected ArchiveReader |
getArchiveReader(java.io.File f,
long offset)
|
protected ArchiveReader |
getArchiveReader(java.lang.String arc,
java.io.InputStream is,
boolean atFirstRecord)
|
static boolean |
isARCSuffix(java.lang.String arcName)
|
boolean |
isCompressed(java.io.File arcFile)
|
static boolean |
testCompressedARCFile(java.io.File arcFile)
Check file is compressed and in ARC GZIP format. |
static boolean |
testCompressedARCFile(java.io.File arcFile,
boolean skipSuffixCheck)
Check file is compressed and in ARC GZIP format. |
static boolean |
testCompressedARCStream(java.io.InputStream is)
Tests passed stream is gzip stream by reading in the HEAD. |
Methods inherited from class org.archive.io.ArchiveReaderFactory |
---|
addUserAgent, asRepositionable, getArchiveReader, getArchiveReader, getArchiveReader, getArchiveReader, getArchiveReader, makeARCLocal |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ARCReaderFactory()
Method Detail |
---|
public static ARCReader get(java.lang.String arcFileOrUrl) throws java.net.MalformedURLException, java.io.IOException
java.net.MalformedURLException
java.io.IOException
public static ARCReader get(java.lang.String arcFileOrUrl, long offset) throws java.net.MalformedURLException, java.io.IOException
java.net.MalformedURLException
java.io.IOException
public static ARCReader get(java.io.File f) throws java.io.IOException
java.io.IOException
public static ARCReader get(java.io.File f, long offset) throws java.io.IOException
java.io.IOException
protected ArchiveReader getArchiveReader(java.io.File f, long offset) throws java.io.IOException
getArchiveReader
in class ArchiveReaderFactory
java.io.IOException
public static ARCReader get(java.io.File f, boolean skipSuffixTest, long offset) throws java.io.IOException
f
- An arcfile to read.skipSuffixTest
- Set to true if want to test that ARC has proper
suffix. Use this method and pass false
to open ARCs
with the .open
or otherwise suffix.offset
- Have returned ARCReader set to start reading at passed
offset.
java.io.IOException
protected ArchiveReader getArchiveReader(java.io.File arcFile, boolean skipSuffixTest, long offset) throws java.io.IOException
java.io.IOException
public static ArchiveReader get(java.lang.String s, java.io.InputStream is, boolean atFirstRecord) throws java.io.IOException
java.io.IOException
protected ArchiveReader getArchiveReader(java.lang.String arc, java.io.InputStream is, boolean atFirstRecord) throws java.io.IOException
getArchiveReader
in class ArchiveReaderFactory
java.io.IOException
public static ARCReader get(java.net.URL arcUrl, long offset) throws java.io.IOException
offset
. This version of get
will not bring the ARC local but will try to stream across the net making
an HTTP 1.1 Range request on remote http server (RFC1435 Section 14.35).
arcUrl
- HTTP URL for an ARC (All ARCs considered remote).offset
- Offset into ARC at which to start fetching.
java.io.IOException
public static ARCReader get(java.net.URL arcUrl) 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.
arcUrl
- An URL that points at an ARC.
java.io.IOException
public boolean isCompressed(java.io.File arcFile) throws java.io.IOException
isCompressed
in class ArchiveReaderFactory
arcFile
- File to test.
arcFile
is compressed ARC.
java.io.IOException
public static boolean testCompressedARCFile(java.io.File arcFile) throws java.io.IOException
arcFile
- File to test if its Internet Archive ARC file
GZIP compressed.
java.io.IOException
- If file does not exist or is not unreadable.public static boolean testCompressedARCFile(java.io.File arcFile, boolean skipSuffixCheck) throws java.io.IOException
arcFile
- File to test if its Internet Archive ARC file
GZIP compressed.skipSuffixCheck
- Set to true if we're not to test on the
'.arc.gz' suffix.
java.io.IOException
- If file does not exist or is not unreadable.public static boolean isARCSuffix(java.lang.String arcName)
public static boolean testCompressedARCStream(java.io.InputStream is) throws java.io.IOException
is
- An InputStream.
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |