dk.netarkivet.harvester.harvesting.metadata
Class MetadataFileWriterArc

java.lang.Object
  extended by dk.netarkivet.harvester.harvesting.metadata.MetadataFileWriter
      extended by dk.netarkivet.harvester.harvesting.metadata.MetadataFileWriterArc

public class MetadataFileWriterArc
extends MetadataFileWriter

MetadataFileWriter that writes to ARC files.


Field Summary
 
Fields inherited from class dk.netarkivet.harvester.harvesting.metadata.MetadataFileWriter
MDF_ARC, MDF_WARC, metadataFormat
 
Constructor Summary
MetadataFileWriterArc()
           
 
Method Summary
 void close()
          Close the metadatafile Writer.
static MetadataFileWriter createWriter(java.io.File metadataARCFile)
          Create a MetadataFileWriter for ARC output.
 java.io.File getFile()
           
 void write(java.lang.String uri, java.lang.String contentType, java.lang.String hostIP, long fetchBeginTimeStamp, byte[] payload)
          Write a record to the archive file.
 void writeFileTo(java.io.File file, java.lang.String uri, java.lang.String mime)
          Write the given file to the metadata file.
 boolean writeTo(java.io.File fileToArchive, java.lang.String URL, java.lang.String mimetype)
          Writes a File to an ARCWriter, if available, otherwise logs the failure to the class-logger.
 
Methods inherited from class dk.netarkivet.harvester.harvesting.metadata.MetadataFileWriter
getMetadataArchiveFileName, initializeMetadataFormat, insertFiles, resetMetadataFormat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataFileWriterArc

public MetadataFileWriterArc()
Method Detail

createWriter

public static MetadataFileWriter createWriter(java.io.File metadataARCFile)
Create a MetadataFileWriter for ARC output.

Parameters:
metadataARCFile - The metadata ARC File
Returns:
MetadataFileWriter for writing metadata files in ARC

close

public void close()
Description copied from class: MetadataFileWriter
Close the metadatafile Writer.

Specified by:
close in class MetadataFileWriter

getFile

public java.io.File getFile()
Specified by:
getFile in class MetadataFileWriter
Returns:
the finished metadataFile

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)
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. TODO I wonder if this is a clone of the ARCUtils method. (nicl)

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)