Class MetadataFileWriterWarc

    • Method Detail

      • createWriter

        public static MetadataFileWriter createWriter​(java.io.File metadataWarcFile)
        Create a MetadataFileWriter for WARC output.
        Parameters:
        metadataWarcFile - The WARC output file
        Returns:
        MetadataFileWriter for writing metadata files in WARC
      • open

        protected void open()
      • insertInfoRecord

        public void insertInfoRecord​(org.jwat.common.ANVLRecord payloadToInfoRecord)
        Insert a warcInfoRecord in the WARC-file, if it doesn't already exists. saves the recordID of the written info-record for future reference to be used for later in the
        Parameters:
        payloadToInfoRecord - the given payload for this record.
      • writeFileTo

        public void writeFileTo​(java.io.File file,
                                java.lang.String uri,
                                java.lang.String mime)
        Description copied from class: MetadataFileWriter
        Write the given file to the metadata file.
        Specified by:
        writeFileTo in class MetadataFileWriter
        Parameters:
        file - A given file with metadata to write to the metadata archive file.
        uri - The uri associated with the piece of metadata
        mime - The mimetype associated with the piece of metadata
      • writeTo

        public boolean writeTo​(java.io.File fileToArchive,
                               java.lang.String URL,
                               java.lang.String mimetype)
        Description copied from class: MetadataFileWriter
        Writes a File to an ARCWriter, if available, otherwise logs the failure to the class-logger.
        Specified by:
        writeTo in class MetadataFileWriter
        Parameters:
        fileToArchive - the File to archive
        URL - the URL with which it is stored in the arcfile
        mimetype - The mimetype of the File-contents
        Returns:
        true, if file exists, and is written to the arcfile.
      • write

        public void write​(java.lang.String uri,
                          java.lang.String contentType,
                          java.lang.String hostIP,
                          long fetchBeginTimeStamp,
                          byte[] payload)
                   throws java.io.IOException
        Description copied from class: MetadataFileWriter
        Write a record to the archive file.
        Specified by:
        write in class MetadataFileWriter
        Parameters:
        uri - record URI
        contentType - content-type of record
        hostIP - resource ip-address
        fetchBeginTimeStamp - record datetime
        payload - A byte array containing the payload
        Throws:
        java.io.IOException
        See Also:
        ARCWriter.write(String uri, String contentType, String hostIP, long fetchBeginTimeStamp, long recordLength, InputStream in)