Class BitarchiveRecord
- java.lang.Object
-
- dk.netarkivet.common.distribute.arcrepository.BitarchiveRecord
-
- All Implemented Interfaces:
Serializable
public class BitarchiveRecord extends Object implements Serializable
Class to hold the result of a lookup operation in the bitarchive: The metadata information associated with the record The actual byte content The name of the file the data were retrieved from If length of record exceeds value of Settings.BITARCHIVE_LIMIT_FOR_RECORD_DATATRANSFER_IN_FILE The record is stored in a RemoteFile.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BitarchiveRecord(org.archive.io.ArchiveRecord record, String filename)
Creates a BitarchiveRecord from the a ArchiveRecord, which can be either a ARCRecord or WARCRecord.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BitarchiveRecord
getBitarchiveRecord(String filename, File f, long index)
InputStream
getData()
Retrieve the data in the record.void
getData(OutputStream out)
Deliver the data in the record to a given OutputStream.String
getFile()
Returns the file that this information was loaded from.long
getLength()
Returns the length of the ARCRecord contained.
-
-
-
Constructor Detail
-
BitarchiveRecord
public BitarchiveRecord(org.archive.io.ArchiveRecord record, String filename)
Creates a BitarchiveRecord from the a ArchiveRecord, which can be either a ARCRecord or WARCRecord. Note that record metadata is not included with the BitarchiveRecord, only the payload of the record.If the length of the record is higher than Settings .BITARCHIVE_LIMIT_FOR_RECORD_DATATRANSFER_IN_FILE the data is stored in a RemoteFile, otherwise the data is stored in a byte array.
- Parameters:
record
- the ArchiveRecord that the data should come from. We do not close the ArchiveRecord.filename
- The filename of the ArchiveFile
-
-
Method Detail
-
getFile
public String getFile()
Returns the file that this information was loaded from.- Returns:
- the file that this ARC record comes from.
-
getLength
public long getLength()
Returns the length of the ARCRecord contained.- Returns:
- the length of the ARCRecord contained
-
getData
public InputStream getData()
Retrieve the data in the record. If data is in RemoteFile, this operation deletes the RemoteFile.- Returns:
- the data from the ARCRecord as an InputStream.
- Throws:
IllegalState
- if remotefile already deleted
-
getData
public void getData(OutputStream out)
Deliver the data in the record to a given OutputStream. If data is in RemoteFile, this operation deletes the RemoteFile- Parameters:
out
- deliver the data to this outputstream- Throws:
IOFailure
- if any IOException occurs reading or writing the dataIllegalState
- if remotefile already deleted
-
getBitarchiveRecord
public static BitarchiveRecord getBitarchiveRecord(String filename, File f, long index)
-
-