|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.netarkivet.common.utils.arc.ARCUtils
public class ARCUtils
Various utilities that do stuff that ARCWriter does not provide. Also includes method for converting an ARCRecord to a byte array. TODO: Turn this into a wrapper around ARCWriter instead.
Field Summary | |
---|---|
static java.lang.String |
RESPONSETEXT
Extra ARC Record metadata |
Constructor Summary | |
---|---|
ARCUtils()
|
Method Summary | |
---|---|
static org.archive.io.arc.ARCWriter |
createARCWriter(java.io.File newFile)
Create new ARCWriter, writing to arcfile newFile. |
static java.util.Map<java.lang.String,java.lang.Object> |
getHeadersFromARCFile(java.io.InputStream in,
java.lang.Long offset)
TODO: write unit test |
static org.archive.io.arc.ARCWriter |
getToolsARCWriter(java.io.PrintStream stream,
java.io.File destinationArcfile)
Return an ARCWriter suitable for the tools ArcMerge and ArcWrap. |
static void |
insertARCFile(java.io.File arcFile,
org.archive.io.arc.ARCWriter aw)
Insert the contents of an ARC file (skipping an optional initial filedesc: header) in another ARCfile. |
static byte[] |
readARCRecord(org.archive.io.arc.ARCRecord in)
Read the contents of an ARC record into a byte array. |
static void |
writeFileToARC(org.archive.io.arc.ARCWriter aw,
java.io.File file,
java.lang.String uri,
java.lang.String mime)
Write a file to an ARC file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String RESPONSETEXT
Constructor Detail |
---|
public ARCUtils()
Method Detail |
---|
public static void insertARCFile(java.io.File arcFile, org.archive.io.arc.ARCWriter aw)
arcFile
- An ARC file to read.aw
- A place to write the arc records
IOFailure
- if there are problems reading the file.public static org.archive.io.arc.ARCWriter createARCWriter(java.io.File newFile)
newFile
- the ARCfile, that the ARCWriter writes to.
public static void writeFileToARC(org.archive.io.arc.ARCWriter aw, java.io.File file, java.lang.String uri, java.lang.String mime)
aw
- The ARCWriter doing the writingfile
- The file we want to write to the ARC fileuri
- The uri for the ARCRecord being writtenmime
- The mimetype for the ARCRecord being written
ArgumentNotValid
- if any arguments aw and file are null
and arguments uri and mime are null or empty.public static org.archive.io.arc.ARCWriter getToolsARCWriter(java.io.PrintStream stream, java.io.File destinationArcfile) throws java.io.IOException
stream
- the given PrintStream.destinationArcfile
- the given destination ARC file.
java.io.IOException
- redirect from ARCWriter constructurepublic static byte[] readARCRecord(org.archive.io.arc.ARCRecord in) throws java.io.IOException
in
- An ARC record to read from. After reading, the ARC Record
will no longer have its own data available for reading.
java.io.IOException
- If there is an error reading the data, or if the
record is longer than Integer.MAX_VALUE (since we can't make bigger
arrays).public static java.util.Map<java.lang.String,java.lang.Object> getHeadersFromARCFile(java.io.InputStream in, java.lang.Long offset) throws java.io.IOException
in
- pointing at start of ARC record.offset
- into ARC file.
java.io.IOException
- if fails to read ARC files or ARC files isn't valid.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |