[page Tools] [t1]Tools[t1] [section] There are two tools available for processing files and directories: [l] [i][javadoc hoglet,org.hoglet.tools.FileProcessor /] - will process an input file and write it out to the output file.[i] [i][javadoc hoglet,org.hoglet.tools.DirectoryProcessor /] - will process all the files (limited to a file extension) in a start directory and write those files out to the output directory, it will change the file extension to that nominated.[i] [l] Each tool also has a main method so that it can be called directly. It should be noted that each processor makes use of a [link xml-configured-processor.html]XML configured processor[link] to configure the processor with handlers, tags and delimiters for the parser. [/section] [t2]FileProcessor[t2] [section] Process an input file containing hoglet markup and write to the output file. [t3]Usage[t3] [com]java org.hoglet.tools.FileProcessor \[xml config file] \[input file] \[output file] \[overwrite][com] Supports the following arguments: [table] [tr header]Argument|Optional|Description[tr] [tr]xml config file|No|Is the full path to the config file for the tag, handlers and delimiters that the parser should use for processing.[tr] [tr]input file|No|The input file that contains the hoglet markup.[tr] [tr]output file|No|The output file.[tr] [tr]overwrite|Yes|Should be either: true or false. If true then the processor will overwrite the output file if it already exists. If false and the output file already exists then the output file is not overwritten and an error is returned.[tr] [table] [t3]Example[t3] This assumes that you are running hoglet from the install directory using the default tag handlers config file. [com]java org.hoglet.tools.FileProcessor data/tag-handlers.xml /home/me/myfile.txt /home/me/myfile.html true[com] [/section] [t2]DirectoryProcessor[t2] [section] Process files in an input directory containing hoglet markup and write to the output directory. The files to be processed are limited by a file extension, output files are given the same name as the input file but assigned the specified file extension. If required the processor will recurse down the directory tree, processing each directory. [t3]Usage[t3] [com] java org.hoglet.tools.DirectoryProcessor \[xml config file] \[input directory] \[input file extension] \[output directory] \[output file extension] \[overwrite] \[recurse directories][com] Supports the following arguments: [table] [tr header]Argument|Optional|Description[tr] [tr]xml config file|No|Is the full path to the config file for the tag, handlers and delimiters that the parser should use for processing.[tr] [tr]input directory|No|The input directory to process.[tr] [tr]input file extension|No|Limit the files to process to those with this file extension.[tr] [tr]output directory|No|The output directory to process.[tr] [tr]output file extension|No|Give the processed file this file extension. The original file extension is stripped, i.e. index.txt would become index.html.[tr] [tr]overwrite|Yes|Should be either: true or false. If true then the processor will overwrite the output file if it already exists. If false and the output file already exists then the output file is not overwritten and an error is returned.[tr] [tr]recurse directories|Yes|Should be either: true or false. If true then the processor will recurse down the directory tree (starting at the input directory of course) and process each directory. If false then only the input directory will be processed.[tr] [table] [t3]Example[t3] This assumes that you are running hoglet from the install directory using the default tag handlers config file. [com]java org.hoglet.tools.DirectoryProcessor data/tag-handlers.xml /home/me txt /home/me html true true[com] [/section] [/page]