Class MetadataFileWriterArc
- java.lang.Object
-
- dk.netarkivet.harvester.harvesting.metadata.MetadataFileWriter
-
- 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
CDX_URI_SCHEME, MDF_ARC, MDF_WARC, metadataFormat
-
-
Constructor Summary
Constructors Constructor Description MetadataFileWriterArc()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the metadatafile Writer.static MetadataFileWriter
createWriter(File metadataARCFile)
Create aMetadataFileWriter
for ARC output.File
getFile()
protected void
open()
void
write(String uri, String contentType, String hostIP, long fetchBeginTimeStamp, byte[] payload)
Write a record to the archive file.void
writeFileTo(File file, String uri, String mime)
Write the given file to the metadata file.boolean
writeTo(File fileToArchive, String URL, 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
compressRecords, getAlternateCDXURI, getCDXURI, getMetadataArchiveFileName, initializeMetadataFormat, insertFiles, resetMetadataFormat
-
-
-
-
Method Detail
-
createWriter
public static MetadataFileWriter createWriter(File metadataARCFile)
Create aMetadataFileWriter
for ARC output.- Parameters:
metadataARCFile
- The metadata ARCFile
- Returns:
MetadataFileWriter
for writing metadata files in ARC
-
open
protected void open()
-
close
public void close()
Description copied from class:MetadataFileWriter
Close the metadatafile Writer.- Specified by:
close
in classMetadataFileWriter
-
getFile
public File getFile()
- Specified by:
getFile
in classMetadataFileWriter
- Returns:
- the finished metadataFile
-
writeFileTo
public void writeFileTo(File file, String uri, String mime)
Description copied from class:MetadataFileWriter
Write the given file to the metadata file.- Specified by:
writeFileTo
in classMetadataFileWriter
- Parameters:
file
- A given file with metadata to write to the metadata archive file.uri
- The uri associated with the piece of metadatamime
- The mimetype associated with the piece of metadata
-
writeTo
public boolean writeTo(File fileToArchive, String URL, String mimetype)
Writes a File to an ArcWriter, if available, otherwise logs the failure to the class-logger.- Specified by:
writeTo
in classMetadataFileWriter
- Parameters:
fileToArchive
- the File to archiveURL
- the URL with which it is stored in the arcfilemimetype
- The mimetype of the File-contents- Returns:
- true, if file exists, and is written to the arcfile.
-
write
public void write(String uri, String contentType, String hostIP, long fetchBeginTimeStamp, byte[] payload) throws IOException
Description copied from class:MetadataFileWriter
Write a record to the archive file.- Specified by:
write
in classMetadataFileWriter
- Parameters:
uri
- record URIcontentType
- content-type of recordhostIP
- resource ip-addressfetchBeginTimeStamp
- record datetimepayload
- A byte array containing the payload- Throws:
IOException
- See Also:
ARCWriter.write(String uri, String contentType, String hostIP, long fetchBeginTimeStamp, long recordLength, InputStream in)
-
-