public abstract class FileBatchProcessor
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
currentFileNumber
Current document.
|
protected java.lang.String[] |
fileNames
Input file names.
|
protected int |
filesToProcess
Number of documents to process.
|
protected int |
initParams
# params before input file specs.
|
protected java.lang.String |
outputDirectoryName
Output directory name.
|
protected java.io.PrintStream |
printStream
Wrapper for printStream to allow utf-8 output.
|
Constructor and Description |
---|
FileBatchProcessor()
Create file batch processor.
|
Modifier and Type | Method and Description |
---|---|
int |
getCurrentFileNumber()
Get index of file currently being processed.
|
int |
getNumberOfFilesToProcess()
Get number of files to process.
|
java.lang.String |
getOutputDirectoryName()
Get output directory name.
|
java.io.PrintStream |
getPrintStream()
Get print stream.
|
void |
incrementCurrentFileNumber()
Increment index of file currently being processed.
|
boolean |
initialize()
Initialize.
|
int |
processFiles()
Process files.
|
abstract void |
processOneFile(java.lang.String inputFileName)
Process one input file.
|
void |
run()
Run file batch processor.
|
void |
setCurrentFileNumber(int currentFileNumber)
Set index of file currently being processed.
|
void |
setInputFileNames(java.lang.String[] inputFileNames,
int startIndex)
Set input file names.
|
void |
setOutputDirectoryName(java.lang.String outputDirectoryName)
Set output directory name.
|
void |
terminate(int filesProcessed,
long processingTime)
Terminate.
|
protected int initParams
protected int filesToProcess
protected int currentFileNumber
protected java.lang.String outputDirectoryName
protected java.lang.String[] fileNames
protected java.io.PrintStream printStream
public FileBatchProcessor() throws java.lang.Exception
java.lang.Exception
public void run()
public boolean initialize() throws java.lang.Exception
java.lang.Exception
public abstract void processOneFile(java.lang.String inputFileName) throws java.lang.Exception
inputFileName
- Input file name.java.lang.Exception
public int processFiles() throws java.lang.Exception
java.lang.Exception
public void terminate(int filesProcessed, long processingTime)
filesProcessed
- Number of files processed.processingTime
- Processing time in seconds.public void setOutputDirectoryName(java.lang.String outputDirectoryName)
outputDirectoryName
- Output directory name.public java.lang.String getOutputDirectoryName()
public void setInputFileNames(java.lang.String[] inputFileNames, int startIndex)
inputFileNames
- String array of input file names.
May contain wildcards.startIndex
- Position in inputFileNames at
which file names start.public int getNumberOfFilesToProcess()
public int getCurrentFileNumber()
public void setCurrentFileNumber(int currentFileNumber)
currentFileNumber
- Index of file currently being processed.public void incrementCurrentFileNumber()
public java.io.PrintStream getPrintStream()