|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.netarkivet.common.utils.batch.FileBatchJob dk.netarkivet.common.utils.batch.ChecksumJob
public class ChecksumJob
Class responsible for checksumming a list of files.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class dk.netarkivet.common.utils.batch.FileBatchJob |
---|
FileBatchJob.ExceptionOccurrence |
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
log
The log. |
static java.lang.String |
STRING_FILENAME_SEPARATOR
Characters used for separating a file identifier from the checksum in the output from a checksum job. |
Fields inherited from class dk.netarkivet.common.utils.batch.FileBatchJob |
---|
batchJobTimeout, exceptions, filesFailed, noOfFilesProcessed |
Constructor Summary | |
---|---|
ChecksumJob()
The constructor. |
Method Summary | |
---|---|
void |
finish(java.io.OutputStream os)
Finishing the job requires nothing particular. |
void |
initialize(java.io.OutputStream os)
Initialization of a ChecksumJob: a new structure for storing files failed is created. |
static java.lang.String |
makeLine(java.lang.String filename,
java.lang.String checksum)
Create a line in checksum job format from a filename and a checksum. |
static KeyValuePair<java.lang.String,java.lang.String> |
parseLine(java.lang.String line)
Parse a line of output into a key-value pair. |
boolean |
processFile(java.io.File file,
java.io.OutputStream os)
Generates MD5 checksum for file identified by 'file' and writes the checksum to the given OutputStream. |
java.lang.String |
toString()
Write a human-readily description of this ChecksumJob object. |
Methods inherited from class dk.netarkivet.common.utils.batch.FileBatchJob |
---|
addException, addFinishException, addInitializeException, getBatchJobTimeout, getExceptions, getFilenamePattern, getFilesFailed, getNoOfFilesProcessed, maxExceptionsReached, postProcess, processOnlyFileNamed, processOnlyFilesMatching, processOnlyFilesMatching, processOnlyFilesNamed, setBatchJobTimeout |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected transient org.apache.commons.logging.Log log
public static final java.lang.String STRING_FILENAME_SEPARATOR
Constructor Detail |
---|
public ChecksumJob()
Method Detail |
---|
public void initialize(java.io.OutputStream os)
initialize
in class FileBatchJob
os
- The output stream where the output data is written.FileBatchJob.initialize(OutputStream)
public boolean processFile(java.io.File file, java.io.OutputStream os)
processFile
in class FileBatchJob
file
- The file to process.os
- The outputStream to write the result to
FileBatchJob.processFile(File, OutputStream)
public void finish(java.io.OutputStream os)
finish
in class FileBatchJob
os
- The output stream where the output data is written.FileBatchJob.finish(OutputStream)
public static java.lang.String makeLine(java.lang.String filename, java.lang.String checksum)
filename
- A filename (no path)checksum
- An MD5 checksum
public static KeyValuePair<java.lang.String,java.lang.String> parseLine(java.lang.String line) throws ArgumentNotValid
line
- The line to parse, of the form
filename##checksum
ArgumentNotValid
- if the line is not on the correct form.public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |