java.lang.Object
java.lang.Thread
eu.steffo.cleaver.logic.job.Job
eu.steffo.cleaver.logic.job.StitchJob
- All Implemented Interfaces:
Runnable
public class StitchJob extends Job
A
Job
to one or more chopped (*.chp + *.cXX) files back into the original file.
The *.chp file is parsed to discover how to revert the chop process, then multiple InputStreams
are created and the original file is
recreated through a FileOutputStream
.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields Modifier and Type Field Description private static int
BUFFER_SIZE
The size of the buffer where bytes are read to before being written into theOutputStream
(currently 8192 bytes).private Document
chpDocument
TheDocument
created by parsing the *.chp file as XML.private File
chpFolder
Thefolder
where the *.chp file is located.private String
cryptKey
The password to be used in the decryption step(s), if there are any. -
Constructor Summary
Constructors Constructor Description StitchJob(File file)
Construct a StitchJob, specifying the *.chp file to import the settings from.StitchJob(File file, 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(File chpFile, String cryptKey, Runnable updateTable)
Construct a StitchJob, and additionally specify theRunnable
that should be called on progress updates. -
Method Summary
Modifier and Type Method Description protected static Document
getChpFileDocument(File chpFile)
String
getFileString()
String
getOperationsString()
private File
getResultFile()
String
getTypeString()
void
run()
Methods inherited from class eu.steffo.cleaver.logic.job.Job
getProgress, getProgressString, 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
-
Field Details
-
cryptKey
The password to be used in the decryption step(s), if there are any. -
chpFolder
Thefolder
where the *.chp file is located. The original file will be placed in that folder when it is re-created. -
chpDocument
TheDocument
created by parsing the *.chp file as XML. -
BUFFER_SIZE
private static final int BUFFER_SIZEThe size of the buffer where bytes are read to before being written into theOutputStream
(currently 8192 bytes).- See Also:
- Constant Field Values
-
-
Constructor Details
-
StitchJob
Construct a StitchJob, specifying the *.chp file to import the settings from.- Parameters:
file
- The *.chp file.- Throws:
ChpFileError
- If an error is encountered while parsing the *.chp file.
-
StitchJob
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 an error is encountered while parsing the *.chp file.
-
StitchJob
Construct a StitchJob, and additionally specify theRunnable
that should be called on progress updates.- Parameters:
chpFile
- The *.chp file.cryptKey
- The encryption key to use while decrypting the files.updateTable
- TheRunnable
that should be invoked whenJob.setProgress(Progress)
is called.- Throws:
ChpFileError
- If an error is encountered while parsing the *.chp file.- See Also:
StitchJob(File, String)
-
-
Method Details
-
getResultFile
-
getTypeString
- Specified by:
getTypeString
in classJob
- Returns:
- The
String
that should be displayed in the Type column of theJobs Table
.
-
getFileString
- Specified by:
getFileString
in classJob
- Returns:
- The
String
that should be displayed in the File column of theJobs Table
.
-
getOperationsString
- Specified by:
getOperationsString
in classJob
- Returns:
- The
String
that should be displayed in the Operations column of theJobs Table
.
-
getChpFileDocument
- Parameters:
chpFile
- The file to create aDocument
from.- Returns:
- The created
Document
. - Throws:
ChpFileError
- If the .chp does not exist, or is corrupt.
-
run
public void run()
-