Package io.archivesunleashed.data
Class ArcRecordUtils
- java.lang.Object
-
- io.archivesunleashed.data.ArcRecordUtils
-
public final class ArcRecordUtils extends Object
Utilities for working withARCRecord
s (from archive.org APIs).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.archive.io.arc.ARCRecord
fromBytes(byte[] bytes)
Converts raw bytes into anARCRecord
.static byte[]
getBodyContent(org.archive.io.arc.ARCRecord record)
Extracts contents of the body from anARCRecord
.static byte[]
getContent(org.archive.io.arc.ARCRecord record)
Extracts raw contents from anARCRecord
(including HTTP headers).static byte[]
toBytes(org.archive.io.arc.ARCRecord record)
Converts ARC record into raw bytes.
-
-
-
Method Detail
-
fromBytes
public static org.archive.io.arc.ARCRecord fromBytes(byte[] bytes) throws IOException
Converts raw bytes into anARCRecord
.- Parameters:
bytes
- raw bytes- Returns:
- parsed
ARCRecord
- Throws:
IOException
- if there is an issue
-
toBytes
public static byte[] toBytes(org.archive.io.arc.ARCRecord record) throws IOException
Converts ARC record into raw bytes.- Parameters:
record
- conents of WARC response record- Returns:
- raw contents
- Throws:
IOException
- if there is an issue
-
getContent
public static byte[] getContent(org.archive.io.arc.ARCRecord record) throws IOException
Extracts raw contents from anARCRecord
(including HTTP headers).- Parameters:
record
- theARCRecord
- Returns:
- raw contents
- Throws:
IOException
- if there is an issue
-
getBodyContent
public static byte[] getBodyContent(org.archive.io.arc.ARCRecord record) throws IOException
Extracts contents of the body from anARCRecord
. Excludes HTTP headers.- Parameters:
record
- theARCRecord
- Returns:
- contents of the body
- Throws:
IOException
- if there is an issue
-
-