java.lang.Object
java.lang.Thread
eu.steffo.cleaver.logic.job.Job
eu.steffo.cleaver.logic.job.ChopJob
- All Implemented Interfaces:
Runnable
public class ChopJob extends Job
A
Job
to convert a file into one or more chopped (*.chp + *.cXX) files.
The conversion is done in steps, which may be skipped if the required configuration is null
:
- Compress (if
compressConfig
is notnull
) - Crypt (if
cryptConfig
is notnull
) - Split (if
splitConfig
is notnull
) - *.chp file creation
-
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 ICompressConfig
compressConfig
TheIConfig
for the Compress step.private ICryptConfig
cryptConfig
TheIConfig
for the Crypt step.private File
fileToChop
The file to chop.private ISplitConfig
splitConfig
TheIConfig
for the Split step. -
Constructor Summary
Constructors Constructor Description ChopJob(File fileToChop, ICompressConfig compressConfig, ICryptConfig cryptConfig, ISplitConfig splitConfig)
Create a new ChopJob (without progress updates support).ChopJob(File fileToChop, ICompressConfig compressConfig, ICryptConfig cryptConfig, ISplitConfig splitConfig, Runnable onProgressChange)
Create a new ChopJob (with progress updates support). -
Method Summary
Modifier and Type Method Description protected void
createChpFile(OutputStream outputStream)
Generate the element tree by calling theICleaverOutputStream.toElement(Document)
method on the passedOutputStream
and by writing the results on a file with aTransformer
.protected OutputStream
createCompressOutputStream(OutputStream sourceOutputStream)
Create aOutputStream
based on thecompressConfig
of this ChopJob.protected OutputStream
createCryptOutputStream(OutputStream sourceOutputStream)
Create aOutputStream
based on thecryptConfig
of this ChopJob.protected OutputStream
createSplitOutputStream()
Create aOutputStream
based on thesplitConfig
of this ChopJob.String
getFileString()
String
getOperationsString()
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
-
fileToChop
The file to chop. -
cryptConfig
TheIConfig
for the Crypt step. -
compressConfig
TheIConfig
for the Compress step. -
splitConfig
TheIConfig
for the Split step.
-
-
Constructor Details
-
ChopJob
public ChopJob(File fileToChop, ICompressConfig compressConfig, ICryptConfig cryptConfig, ISplitConfig splitConfig, Runnable onProgressChange)Create a new ChopJob (with progress updates support).- Parameters:
fileToChop
- The file to chop.compressConfig
- TheIConfig
for the Compress step.cryptConfig
- TheIConfig
for the Crypt step.splitConfig
- TheIConfig
for the Split step.onProgressChange
- ARunnable
that will be invoked on the GUIThread
(withSwingUtilities.invokeLater(Runnable)
) every timeJob.setProgress(Progress)
is called.- See Also:
Job(Runnable)
-
ChopJob
public ChopJob(File fileToChop, ICompressConfig compressConfig, ICryptConfig cryptConfig, ISplitConfig splitConfig)Create a new ChopJob (without progress updates support).- Parameters:
fileToChop
- The file to chop.compressConfig
- TheIConfig
for the Compress step.cryptConfig
- TheIConfig
for the Crypt step.splitConfig
- TheIConfig
for the Split step.- See Also:
ChopJob(File, ICompressConfig, ICryptConfig, ISplitConfig, Runnable)
,Job()
-
-
Method Details
-
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
.
-
createSplitOutputStream
Create aOutputStream
based on thesplitConfig
of this ChopJob. TheOutputStream
will be the sink of the stream chain created inrun()
.- Returns:
- The created
OutputStream
. - Throws:
FileNotFoundException
- If one or more files cannot be created (for example, a directory with the same name is present).- See Also:
CleaverSplitFileOutputStream
,CleaverForkFileOutputStream
,CleaverSimpleFileOutputStream
-
createCompressOutputStream
Create aOutputStream
based on thecompressConfig
of this ChopJob. The createdOutputStream
will wrap theOutputStream
passed as parameter, creating a chain of streams.- Parameters:
sourceOutputStream
- TheOutputStream
that should be wrapped.- Returns:
- The created
OutputStream
, wrapping the one that was passed as parameter. - See Also:
CleaverDeflateOutputStream
-
createCryptOutputStream
Create aOutputStream
based on thecryptConfig
of this ChopJob. The createdOutputStream
will wrap theOutputStream
passed as parameter, creating a chain of streams.- Parameters:
sourceOutputStream
- TheOutputStream
that should be wrapped.- Returns:
- The created
OutputStream
, wrapping the one that was passed as parameter. - See Also:
CleaverCryptOutputStream
-
createChpFile
Generate the element tree by calling theICleaverOutputStream.toElement(Document)
method on the passedOutputStream
and by writing the results on a file with aTransformer
.- Parameters:
outputStream
- TheOutputStream
to create the *.chp file for.
-
run
public void run()
-