public class ChecksumJob extends FileBatchJob
FileBatchJob.ExceptionOccurrence
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
log
The log.
|
static String |
STRING_FILENAME_SEPARATOR
Characters used for separating a file identifier from the checksum in the output from a checksum job.
|
batchJobTimeout, exceptions, filesFailed, noOfFilesProcessed
Constructor and Description |
---|
ChecksumJob()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
finish(OutputStream os)
Finishing the job requires nothing particular.
|
void |
initialize(OutputStream os)
Initialization of a ChecksumJob: a new structure for storing files failed is created.
|
static String |
makeLine(String filename,
String checksum)
Create a line in checksum job format from a filename and a checksum.
|
static KeyValuePair<String,String> |
parseLine(String line)
Parse a line of output into a key-value pair.
|
boolean |
processFile(File file,
OutputStream os)
Generates MD5 checksum for file identified by 'file' and writes the checksum to the given OutputStream.
|
String |
toString()
Write a human-readily description of this ChecksumJob object.
|
addException, addFinishException, addInitializeException, getBatchJobTimeout, getExceptions, getFilenamePattern, getFilesFailed, getNoOfFilesProcessed, maxExceptionsReached, postProcess, processOnlyFileNamed, processOnlyFilesMatching, processOnlyFilesMatching, processOnlyFilesNamed, setBatchJobTimeout
protected static final transient org.slf4j.Logger log
public static final String STRING_FILENAME_SEPARATOR
public ChecksumJob()
public void initialize(OutputStream os)
initialize
in class FileBatchJob
os
- The output stream where the output data is written.FileBatchJob.initialize(OutputStream)
public boolean processFile(File file, OutputStream os)
processFile
in class FileBatchJob
file
- The file to process.os
- The outputStream to write the result toFileBatchJob.processFile(File, OutputStream)
public void finish(OutputStream os)
finish
in class FileBatchJob
os
- The output stream where the output data is written.FileBatchJob.finish(OutputStream)
public static String makeLine(String filename, String checksum)
filename
- A filename (no path)checksum
- An MD5 checksumpublic static KeyValuePair<String,String> parseLine(String line) throws ArgumentNotValid
line
- The line to parse, of the form filename##checksumArgumentNotValid
- if the line is not on the correct form.Copyright © 2005–2018 The Royal Danish Library, the National Library of France and the Austrian National Library.. All rights reserved.