public class ArcReaderFactory extends ReaderFactoryAbstract
ArcReader instances.
The general getReader methods will auto-detect Gzip'ed data
and return the appropriate ArcReader instances.
The other factory methods can be used to return specific
ArcReader instances for compressed or uncompressed records.
Readers are available for both sequential and random reading of records.
Use of buffered methods and/or buffering speeds up the reader considerably.| Modifier and Type | Field and Description |
|---|---|
static int |
PUSHBACK_BUFFER_SIZE
Buffer size used by
PushbackInputStream. |
ARC_MAGIC_HEADER, GZIP_MAGIC, WARC_MAGIC_HEADER| Modifier | Constructor and Description |
|---|---|
protected |
ArcReaderFactory()
Private constructor to enforce factory methods.
|
| Modifier and Type | Method and Description |
|---|---|
static ArcReader |
getReader(java.io.InputStream in)
Creates a new
ArcReader from an InputStream. |
static ArcReader |
getReader(java.io.InputStream in,
int buffer_size)
Creates a new
ArcReader from an InputStream
wrapped by a BufferedInputStream. |
static ArcReaderCompressed |
getReaderCompressed()
Creates a new
ArcReader without any associated
InputStream for random access to GZip compressed records. |
static ArcReaderCompressed |
getReaderCompressed(java.io.InputStream in)
Creates a new
ArcReader from an InputStream
primarily for random access to GZip compressed records. |
static ArcReaderCompressed |
getReaderCompressed(java.io.InputStream in,
int buffer_size)
Creates a new
ArcReader from an InputStream
wrapped by a BufferedInputStream primarily for random
access to GZip compressed records. |
static ArcReaderUncompressed |
getReaderUncompressed()
Creates a new
ArcReader without any associated
InputStream for random access to uncompressed records. |
static ArcReaderUncompressed |
getReaderUncompressed(java.io.InputStream in)
Creates a new
ArcReader from an InputStream
primarily for random access to uncompressed records. |
static ArcReaderUncompressed |
getReaderUncompressed(java.io.InputStream in,
int buffer_size)
Creates a new
ArcReader from an InputStream
wrapped by a BufferedInputStream primarily for random
access to uncompressed records. |
static boolean |
isArcFile(ByteCountingPushBackInputStream pbin)
Check head of
PushBackInputStream for an ARC file identifier. |
static boolean |
isArcRecord(ByteCountingPushBackInputStream pbin)
Check head of
PushBackInputStream for an ARC record identifier. |
isGzipped, isWarcFile, isWarcRecordpublic static final int PUSHBACK_BUFFER_SIZE
PushbackInputStream.protected ArcReaderFactory()
public static boolean isArcFile(ByteCountingPushBackInputStream pbin) throws java.io.IOException
PushBackInputStream for an ARC file identifier.
The identifier for ARC files is "filedesc:" in the beginning.pbin - PushBackInputStream with an ARC version blockjava.io.IOException - if an I/O error occurs while examining head of streampublic static boolean isArcRecord(ByteCountingPushBackInputStream pbin) throws java.io.IOException
PushBackInputStream for an ARC record identifier.
The identifier for ARC files is "filedesc:" in the beginning.pbin - PushBackInputStream with an ARC version blockjava.io.IOException - if an I/O error occurs while examining head of streampublic static ArcReader getReader(java.io.InputStream in, int buffer_size) throws java.io.IOException
ArcReader from an InputStream
wrapped by a BufferedInputStream.
The WarcReader implementation returned is chosen based on
GZip auto detection.in - ARC File represented as InputStreambuffer_size - buffer size to useArcReader based on data read from
InputStreamjava.io.IOException - if an I/O exception occurs during initializationpublic static ArcReader getReader(java.io.InputStream in) throws java.io.IOException
ArcReader from an InputStream.
The WarcReader implementation returned is chosen based on
GZip auto detection.in - ARC File represented as InputStreamArcReader based on data read from
InputStreamjava.io.IOException - if an I/O exception occurs during initializationpublic static ArcReaderUncompressed getReaderUncompressed()
ArcReader without any associated
InputStream for random access to uncompressed records.ArcReader for uncompressed records read from
InputStreampublic static ArcReaderUncompressed getReaderUncompressed(java.io.InputStream in) throws java.io.IOException
ArcReader from an InputStream
primarily for random access to uncompressed records.in - ARC File represented as InputStreamArcReader for uncompressed records read from
InputStreamjava.io.IOException - I/O exception while initializing readerpublic static ArcReaderUncompressed getReaderUncompressed(java.io.InputStream in, int buffer_size) throws java.io.IOException
ArcReader from an InputStream
wrapped by a BufferedInputStream primarily for random
access to uncompressed records.in - ARC File represented as InputStreambuffer_size - buffer size to useArcReader for uncompressed records read from
InputStreamjava.io.IOException - I/O exception while initializing readerpublic static ArcReaderCompressed getReaderCompressed()
ArcReader without any associated
InputStream for random access to GZip compressed records.ArcReader for GZip compressed records read from
InputStreampublic static ArcReaderCompressed getReaderCompressed(java.io.InputStream in) throws java.io.IOException
ArcReader from an InputStream
primarily for random access to GZip compressed records.in - ARC File represented as InputStreamArcReader for GZip compressed records read from
InputStreamjava.io.IOException - I/O exception while initializing readerpublic static ArcReaderCompressed getReaderCompressed(java.io.InputStream in, int buffer_size) throws java.io.IOException
ArcReader from an InputStream
wrapped by a BufferedInputStream primarily for random
access to GZip compressed records.in - ARC File represented as InputStreambuffer_size - buffer size to useArcReader for GZip compressed records read from
InputStreamjava.io.IOException - I/O exception while initializing readerCopyright © 2011–2022. All rights reserved.