Class ChecksumJob

    • Field Detail

      • log

        protected static final transient org.slf4j.Logger log
        The log.
      • STRING_FILENAME_SEPARATOR

        public static final String STRING_FILENAME_SEPARATOR
        Characters used for separating a file identifier from the checksum in the output from a checksum job.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ChecksumJob

        public ChecksumJob()
        The constructor.
    • Method Detail

      • processFile

        public boolean processFile​(File file,
                                   OutputStream os)
        Generates MD5 checksum for file identified by 'file' and writes the checksum to the given OutputStream. Errors during checksumming are logged and files on which checksumming fails are stored in filesFailed.
        Specified by:
        processFile in class FileBatchJob
        Parameters:
        file - The file to process.
        os - The outputStream to write the result to
        Returns:
        false, if errors occurred while processing the file
        See Also:
        FileBatchJob.processFile(File, OutputStream)
      • makeLine

        public static String makeLine​(String filename,
                                      String checksum)
        Create a line in checksum job format from a filename and a checksum.
        Parameters:
        filename - A filename (no path)
        checksum - An MD5 checksum
        Returns:
        A string of the correct format for a checksum job output.
      • parseLine

        public static KeyValuePair<String,​String> parseLine​(String line)
                                                           throws ArgumentNotValid
        Parse a line of output into a key-value pair.
        Parameters:
        line - The line to parse, of the form filename##checksum
        Returns:
        The filename->checksum mapping.
        Throws:
        ArgumentNotValid - if the line is not on the correct form.
      • toString

        public String toString()
        Write a human-readily description of this ChecksumJob object. Writes out the name of the ChecksumJob, the number of files processed, and the number of files that failed during processing.
        Overrides:
        toString in class Object
        Returns:
        a human-readily description of this ChecksumJob object