|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfiletools.fileconverttools.SimpleFileConverter
public abstract class SimpleFileConverter
Abstract base class for a simple file conversion in a specified directory and its subdirectories. Each found file can be converted or copied. The converted and copied files are either stored in the same directory or in a second one, so that the original keeps untouched. Derivied classes need to define concrete algorithms, which (sub-)directories should be converted and which files should be converted/copied.
Field Summary | |
---|---|
protected static int |
BLOCKSIZE
|
Constructor Summary | |
---|---|
SimpleFileConverter()
|
Method Summary | |
---|---|
protected abstract void |
convertFile(java.io.File inputFile,
java.io.File outputFile)
Converts a single file. |
int |
convertInDir(java.io.File inputDir,
java.io.File outputDir)
searches the specified directory and its subdirectories for files and stores a converted (and partially copied) version in another one. |
protected void |
copyFile(java.io.File inputFile,
java.io.File outputFile)
Copies a File by transfering its contents from a filestream to another one block by block Subclasses may override this method to specifiy another copy-algortithm to use. |
protected abstract boolean |
isDirToConvert(java.lang.String dir)
Specifies if the contents of the given directory should be converted. |
protected abstract boolean |
isFileToConvert(java.lang.String filename)
Specifies if the given file should be converted. |
protected abstract boolean |
isFileToCopy(java.lang.String filename)
Specifies if the given file should be copied. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int BLOCKSIZE
Constructor Detail |
---|
public SimpleFileConverter()
Method Detail |
---|
public int convertInDir(java.io.File inputDir, java.io.File outputDir)
IFileConverter
convertInDir
in interface IFileConverter
inputDir
- directory to convertoutputDir
- directory where converted files are stored
IFileConverter.convertInDir(File, File)
protected void copyFile(java.io.File inputFile, java.io.File outputFile)
inputFile
- source for the copy-processoutputFile
- new copy of the fileprotected abstract void convertFile(java.io.File inputFile, java.io.File outputFile)
inputFile
- file to convertoutputFile
- converted fileprotected abstract boolean isDirToConvert(java.lang.String dir)
dir
- path of the directory (relative or absolute)
protected abstract boolean isFileToConvert(java.lang.String filename)
filename
- path of the file
protected abstract boolean isFileToCopy(java.lang.String filename)
filename
- path of the file
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |