Class StitchJob

java.lang.Object
java.lang.Thread
eu.steffo.cleaver.logic.Job
eu.steffo.cleaver.logic.StitchJob
All Implemented Interfaces:
java.lang.Runnable

public class StitchJob
extends Job
A Job that converts chopped (*.chp + *.cXX) files back into regular files.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Thread

    java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
  • Field Summary

    Fields inherited from class java.lang.Thread

    MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
  • Constructor Summary

    Constructors 
    Constructor Description
    StitchJob​(java.io.File file)
    Construct a StitchJob, specifying the *.chp file to import the settings from.
    StitchJob​(java.io.File file, java.lang.String cryptKey)
    Construct a StitchJob, specifying the *.chp file to import the settings from and an encryption key to use while decrypting the files.
    StitchJob​(java.io.File chpFile, java.lang.String cryptKey, java.lang.Runnable updateTable)
    Construct a StitchJob, and additionally specify the Runnable that should be called on progress updates..
  • Method Summary

    Modifier and Type Method Description
    CompressConfig getCompressConfig()  
    CryptConfig getCryptConfig()  
    java.io.File getFile()  
    SplitConfig getSplitConfig()  
    java.lang.String getType()  
    protected static org.w3c.dom.Document openChp​(java.io.File file)  
    protected void parseChp​(org.w3c.dom.Document doc, java.lang.String cryptKey)
    Read a Document and set splitConfig, cryptConfig and compressConfig accordingly.
    void run()
    The function that is run on a different thread when Thread.start() is called.

    Methods inherited from class eu.steffo.cleaver.logic.Job

    getProgress, setProgress

    Methods inherited from class java.lang.Thread

    activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, toString, yield

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • StitchJob

      public StitchJob​(java.io.File file) throws ChpFileError, ProgrammingError
      Construct a StitchJob, specifying the *.chp file to import the settings from.
      Parameters:
      file - The *.chp file.
      Throws:
      ChpFileError - If there's an error while parsing the *.chp file.
      ProgrammingError - It shouldn't be thrown, but it isn't caught to allow its display in the GUI if it actually happens.
    • StitchJob

      public StitchJob​(java.io.File file, java.lang.String cryptKey) throws ChpFileError, ProgrammingError
      Construct a StitchJob, specifying the *.chp file to import the settings from and an encryption key to use while decrypting the files.
      Parameters:
      file - The *.chp file.
      cryptKey - The encryption key to use while decrypting the files.
      Throws:
      ChpFileError - If there's an error while parsing the *.chp file.
      ProgrammingError - It shouldn't be thrown, but it isn't caught to allow its display in the GUI if it actually happens.
      See Also:
      StitchJob(File)
    • StitchJob

      public StitchJob​(java.io.File chpFile, java.lang.String cryptKey, java.lang.Runnable updateTable) throws ChpFileError, ProgrammingError
      Construct a StitchJob, and additionally specify the Runnable that should be called on progress updates..
      Parameters:
      chpFile - The *.chp file.
      cryptKey - The encryption key to use while decrypting the files.
      updateTable - The Runnable that should be invoked when Job.setProgress(Progress) is called.
      Throws:
      ChpFileError - If there's an error while parsing the *.chp file.
      ProgrammingError - It shouldn't be thrown, but it isn't caught to allow its display in the GUI if it actually happens.
      See Also:
      StitchJob(File, String), Job(Runnable)
  • Method Details

    • getType

      public java.lang.String getType()
      Specified by:
      getType in class Job
      Returns:
      The name of the job type, such as "Chop" for a ChopJob.
    • getFile

      public java.io.File getFile()
      Specified by:
      getFile in class Job
      Returns:
      The file path the job should act on.
    • getSplitConfig

      public SplitConfig getSplitConfig()
      Specified by:
      getSplitConfig in class Job
      Returns:
      The SplitConfig of the job. If null, the job shouldn't handle file splitting/merging.
    • getCryptConfig

      public CryptConfig getCryptConfig()
      Specified by:
      getCryptConfig in class Job
      Returns:
      The CryptConfig of the job. If null, the job shouldn't handle file encryption/decryption.
    • getCompressConfig

      public CompressConfig getCompressConfig()
      Specified by:
      getCompressConfig in class Job
      Returns:
      The CompressConfig of the job. If null, the job shouldn't handle file compression/decompression.
    • openChp

      protected static org.w3c.dom.Document openChp​(java.io.File file) throws ChpFileError, ProgrammingError
      Throws:
      ChpFileError
      ProgrammingError
    • parseChp

      protected final void parseChp​(org.w3c.dom.Document doc, java.lang.String cryptKey) throws ChpFileError
      Read a Document and set splitConfig, cryptConfig and compressConfig accordingly.
      Parameters:
      doc - The Document to be read.
      cryptKey - The encryption key to use in the CryptConfig.
      Throws:
      ChpFileError - If there's an error while parsing the *.chp file.
    • run

      public void run()
      Description copied from class: Job
      The function that is run on a different thread when Thread.start() is called. Child classes should override Thread.run().
      Specified by:
      run in interface java.lang.Runnable
      Specified by:
      run in class Job