Class 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 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 data
        IllegalState - if remotefile already deleted