Package openbook.tools

Examples of openbook.tools.CommandProcessor


     *
     * @throws Exception
     */
   
    protected final void run(String[] args) throws Exception {
        CommandProcessor options = new CommandProcessor();
        options.register(true, "-sourcepath").setDefault(CURRENT_DIRECTORY);
        options.register(true, "-d").setDefault(CURRENT_DIRECTORY);
        options.register(true, "-extension").setDefault("");
        options.register(true, "-verbose").setDefault("false");
        registerOptions(options);
       
        String[] inputs = options.setFrom(args);
       
        _sourceDir  = new File(options.getValue("-sourcepath"));
        _destinationDir = new File(options.getValue("-d"));
        verbose = "true".equalsIgnoreCase(options.getValue("-verbose"));
        for (String path : inputs) {
            path = path.replace(File.separatorChar, FORWARD_SLASH);
            InputStream fin = getInputStream(_sourceDir, path);
            if (fin == null) {
                continue;
            }
           
            File outFile = new File(_destinationDir, suffix(path, options.getValue("-extension")));
            FileOutputStream fout = createOutput(outFile);
            if (fout == null) {
                continue;
            }
            PrintStream out = new PrintStream(fout);
View Full Code Here

TOP

Related Classes of openbook.tools.CommandProcessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.