public class BatchConverter extends ProcessExecutor
ProcessExecutor
Note that not every mode will work with every operation. The batch-mode will typically fail with all operations using ImageMagick's image-sequence operators (e.g. -clone).
Sequential and parallel-mode will convert all images and will
save the indices of failed conversions. You can query these
indices with the method getFailedConversions(). The batch mode
behaves differently: it is a all-or-nothing conversion.
| Modifier and Type | Class and Description |
|---|---|
class |
BatchConverter.ConvertException
This nested exception wraps the original exception of failed conversions.
|
static class |
BatchConverter.Mode
Enumeration-type for the conversion mode:
SEQUENTIAL: run commands sequentially for all images
(this mode is mainly for debugging and benchmarking)
PARALLEL: run commands in parallel using a
ProcessExecutor
BATCH: convert images at once with a single command.
|
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy| Constructor and Description |
|---|
BatchConverter(BatchConverter.Mode pMode)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
List<BatchConverter.ConvertException> |
getFailedConversions()
Return the list of exceptions.
|
BatchConverter.Mode |
getMode()
Return the current run-mode
|
void |
processTerminated(ProcessEvent pEvent)
This method is called at normal or abnormal process termination.
|
void |
run(Operation pOp,
List<String> pImages,
String pTargetPattern)
Convert the given images with the given
Operation. |
afterExecute, beforeExecute, destroy, processInitiated, processStarted, shutdownNowallowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, terminated, toStringinvokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submitpublic BatchConverter(BatchConverter.Mode pMode)
pMode - The conversion mode of this BatchConverterpublic void run(Operation pOp, List<String> pImages, String pTargetPattern) throws Exception, IOException, InterruptedException, IM4JavaException
Operation.pOp - the conversion-operationpImages - List of images to convertpTargetPattern - Pattern for the target-files.
See FilenamePatternResolver for detailsExceptionIOExceptionInterruptedExceptionIM4JavaExceptionpublic void processTerminated(ProcessEvent pEvent)
processTerminated in interface ProcessEventListenerprocessTerminated in class ProcessExecutorpublic List<BatchConverter.ConvertException> getFailedConversions()
public BatchConverter.Mode getMode()
Copyright © 2019. All rights reserved.