|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.archive.io.ArchiveReaderFactory
public class ArchiveReaderFactory
Factory that returns an Archive file Reader. Returns Readers for ARCs or WARCs.
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, 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 |
Constructor Summary | |
---|---|
protected |
ArchiveReaderFactory()
Shutdown any public access to default constructor. |
Method Summary | |
---|---|
protected void |
addUserAgent(java.net.HttpURLConnection connection)
|
protected java.io.InputStream |
asRepositionable(java.io.InputStream is)
|
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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ArchiveReaderFactory()
Method Detail |
---|
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.IOException
java.net.MalformedURLException
java.io.IOException
protected ArchiveReader getArchiveReader(java.lang.String arcFileOrUrl) throws java.net.MalformedURLException, java.io.IOException
java.net.MalformedURLException
java.io.IOException
protected ArchiveReader getArchiveReader(java.lang.String arcFileOrUrl, long offset) throws java.net.MalformedURLException, java.io.IOException
java.net.MalformedURLException
java.io.IOException
public static ArchiveReader get(java.io.File f) throws java.io.IOException
f
- An Archive file to read.
java.io.IOException
protected ArchiveReader getArchiveReader(java.io.File f) throws java.io.IOException
java.io.IOException
public 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.IOException
protected ArchiveReader getArchiveReader(java.io.File f, 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
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.IOException
protected java.io.InputStream asRepositionable(java.io.InputStream is)
is
-
is
is
RepositionableInputStream
, returns is
, else we
wrap is
with RepositionableStream
.protected ArchiveReader getArchiveReader(java.lang.String id, java.io.InputStream is, boolean atFirstRecord) throws java.io.IOException
java.io.IOException
public 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.IOException
protected ArchiveReader getArchiveReader(java.net.URL f, long offset) throws java.io.IOException
java.io.IOException
public 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.IOException
protected ArchiveReader getArchiveReader(java.net.URL u) throws java.io.IOException
java.io.IOException
protected ArchiveReader makeARCLocal(java.net.URLConnection connection) throws java.io.IOException
java.io.IOException
protected 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.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |