Package arc.packer
Class FileProcessor
java.lang.Object
arc.packer.FileProcessor
- Direct Known Subclasses:
TexturePackerFileProcessor
Collects files recursively, filtering by file name. Callbacks are provided to process files and the results are collected,
either
processFile(Entry)
or processDir(Entry, Seq)
can be overridden, or both. The entries provided to
the callbacks have the original file, the output directory, and the output file. If setFlattenOutput(boolean)
is
false, the output will match the directory structure of the input.-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddInputRegex
(String... regexes) addInputSuffix
(String... suffixes) Adds a case insensitive suffix for matching input files.protected void
This method should be called byprocessFile(Entry)
orprocessDir(Entry, Seq)
if the return value ofprocess(File, File)
orprocess(File[], File)
should return all the processed files.Processes the specified input files.Processes the specified input file or directory.protected void
processDir
(FileProcessor.Entry entryDir, Seq<FileProcessor.Entry> files) Called for each input directory.protected void
processFile
(FileProcessor.Entry entry) Called with each input file.setComparator
(Comparator<File> comparator) Sets the comparator forprocessDir(Entry, Seq)
.setFlattenOutput
(boolean flattenOutput) setInputFilter
(FilenameFilter inputFilter) setOutputSuffix
(String outputSuffix) Sets the suffix for output files, replacing the extension of the input file.setRecursive
(boolean recursive) Default is true.
-
Constructor Details
-
FileProcessor
public FileProcessor() -
FileProcessor
Copy constructor.
-
-
Method Details
-
setInputFilter
-
setComparator
Sets the comparator forprocessDir(Entry, Seq)
. By default the files are sorted by alpha. -
addInputSuffix
Adds a case insensitive suffix for matching input files. -
addInputRegex
-
setOutputSuffix
Sets the suffix for output files, replacing the extension of the input file. -
setFlattenOutput
-
setRecursive
Default is true. -
process
- Parameters:
outputRoot
- May be null.- Throws:
Exception
- See Also:
-
process
Processes the specified input file or directory.- Parameters:
outputRoot
- May be null if there is no output from processing the files.- Returns:
- the processed files added with
addProcessedFile(Entry)
. - Throws:
Exception
-
process
Processes the specified input files.- Parameters:
outputRoot
- May be null if there is no output from processing the files.- Returns:
- the processed files added with
addProcessedFile(Entry)
. - Throws:
Exception
-
processFile
Called with each input file.- Throws:
Exception
-
processDir
protected void processDir(FileProcessor.Entry entryDir, Seq<FileProcessor.Entry> files) throws Exception Called for each input directory. The files will besorted
. The specified files list can be modified to change which files are processed.- Throws:
Exception
-
addProcessedFile
This method should be called byprocessFile(Entry)
orprocessDir(Entry, Seq)
if the return value ofprocess(File, File)
orprocess(File[], File)
should return all the processed files.
-