Examples of FileUtil


Examples of org.hsqldb.lib.FileUtil

        } catch (Exception e) {}
    }

    static void deleteDatabase(String path) {

        FileUtil fileUtil = FileUtil.getDefaultInstance();

        fileUtil.delete(path + ".backup");
        fileUtil.delete(path + ".properties");
        fileUtil.delete(path + ".script");
        fileUtil.delete(path + ".data");
        fileUtil.delete(path + ".log");
        fileUtil.delete(path + ".lck");
        fileUtil.delete(path + ".csv");
    }
View Full Code Here

Examples of sortpom.util.FileUtil

    /**
     * Instantiates a new sort pom mojo and initiates dependencies to other
     * classes.
     */
    public SortPomImpl() {
        fileUtil = new FileUtil();
        wrapperFactory = new WrapperFactoryImpl(fileUtil);
        xmlProcessor = new XmlProcessor(wrapperFactory);
        xmlProcessingInstructionParser = new XmlProcessingInstructionParser();
    }
View Full Code Here

Examples of sortpom.util.FileUtil

                .setFormatting("\r\n", true, true)
                .setIndent(2, false)
                .setSortOrder("default_0_4_0.xml", null)
                .setSortEntities("scope,groupId,artifactId", "groupId,artifactId", true).createPluginParameters();

        FileUtil fileUtil = new FileUtil();
        fileUtil.setup(pluginParameters);

        String xml = IOUtils.toString(new FileInputStream("src/test/resources/" + inputFileName), UTF_8);
        SAXBuilder parser = new SAXBuilder();
        Document document = parser.build(new ByteArrayInputStream(xml.getBytes(UTF_8)));
View Full Code Here

Examples of xplanetconfigurator.util.FileUtil

        if (!cfg.isFile()) {
            this.logger.fine("Config file is not a file: " + cfg.getAbsolutePath());
            this.selectControlPanel("-config");
            return;
        }
        FileUtil util = new FileUtil();
        String configParameters = null;
        try {
            configParameters = util.getFileAsString(cfg);
        } catch (Exception ex) {
            this.logger.log(Level.SEVERE, null, ex);
            this.popError("Failed to read config file:\n" + cfg.getAbsolutePath() + "\n\n" + ex.getLocalizedMessage());
            return;
        }
View Full Code Here

Examples of xplanetconfigurator.util.FileUtil

     *
     * @param fileInClasspath an example config file stored in the jar file.
     * Example: Big_Moon will read the file /xplanetconfigurator/gui/resources/examples/Bin_Moon
     */
    public void readExampleConfigFile(String fileName) {
        FileUtil util = new FileUtil();
        String dirInClasspath = "/xplanetconfigurator/gui/resources/examples/";
        String file = dirInClasspath + fileName;
        String configParameters = null;
        try {
            configParameters = util.getRessourceAsString(file);
        } catch (Exception ex) {
            this.logger.log(Level.SEVERE, null, ex);
            this.popError("Failed to read example config file:\n" + fileName + "\n\n" + ex.getLocalizedMessage());
            return;
        }
View Full Code Here

Examples of xplanetconfigurator.util.FileUtil

            }
        }
        // Assemble the file name
        String cmdFile = configDir + File.separator + MainFrame.getCONFIG_NAME() + ".cmd";
        File cmd = new File(cmdFile);
        FileUtil util = new FileUtil();
        // Read the parameters from the text area
        String parameters = this.jTextAreaCommandLineParameters.getText();
        // Insert the xplanet exectable at the beginning
        String executable = MainFrame.getXPLANET_EXECUTABLE();
        if (executable != null && !"".equals(executable)) {
            // Check for blanks under Windows
            String osName = System.getProperty("os.name");
            if (osName.matches("(?i).*windows.+")) {
                if (executable.contains(" ")) {
                    executable = "\"" + executable + "\"";
                    this.logger.finer("The windows executable '" + executable + "' contained blanks and where surroundet by \"");
                }
            }
        } else {
            executable = this.guessNameOfExecutable();
        }
        parameters = executable + " " + parameters;
        // insert the downloader
        String javacall = "start \"Downloader\" java -jar xplanet.jar -nogui";
        parameters = javacall + "\n" + parameters;
        this.logger.fine("Writing command file: " + cmdFile);
        try {
            util.printFile(cmdFile, parameters);
        } catch (Exception ex) {
            this.logger.log(Level.SEVERE, null, ex);
            this.popError("Failed to write command file:\n" + cmd.getAbsolutePath() + "\n\n" + ex.getLocalizedMessage());
            return;
        }
View Full Code Here

Examples of xplanetconfigurator.util.FileUtil

            // Insert
            configFileContent = replacement + "\n" + configFileContent;
        }

        this.logger.fine("Writing config file: " + configFile);
        FileUtil util = new FileUtil();
        try {
            util.printFile(configFile, configFileContent);
        } catch (Exception ex) {
            this.logger.log(Level.SEVERE, null, ex);
            this.popError("Failed to write config file:\n" + configFile + "\n\n" + ex.getLocalizedMessage());
            return;
        }
View Full Code Here

Examples of xplanetconfigurator.util.FileUtil

        String configDir = rf.getRessourceDirectory("proxy");
        String file = configDir + File.separator + MainFrame.FILE_NAME_PROXY_CONFIG;
        File f = new File(file);
        if (f.exists()) {
            String proxyConfig = null;
            FileUtil util = new FileUtil();
            try {
                proxyConfig = util.getFileAsString(f);
            } catch (Exception ex) {
                this.logger.log(Level.SEVERE, null, ex);
                return;
            }
            String existingDownloaderConfig = this.getDownloaderConfig();
View Full Code Here

Examples of xplanetconfigurator.util.FileUtil

        buf.append(found);

        XPlanetRessourceFinder rf = new XPlanetRessourceFinder();
        String configDir = rf.getRessourceDirectory("proxy");
        String file = configDir + File.separator + MainFrame.FILE_NAME_PROXY_CONFIG;
        FileUtil util = new FileUtil();
        try {
            util.printFile(file, buf.toString());
        } catch (Exception ex) {
            this.logger.log(Level.SEVERE, null, ex);
        }
    }
View Full Code Here

Examples of xplanetconfigurator.util.FileUtil

            this.jComboBoxSuggestions.addItem(name);
        }
    }

    private void writeExampleConfigurationFromJarToFileSystem(String exampleName) {
        FileUtil util = new FileUtil();
        String dirInClasspath = "/xplanetconfigurator/gui/resources/examples/";
        String fileInClasspath = dirInClasspath + exampleName;
        XPlanetRessourceFinder f = new XPlanetRessourceFinder();
        String dirOnDisc = f.getRessourceDirectory("config");
        String fileOnDisc = dirOnDisc + File.separator + exampleName;
        String msg = "Copy example config file from classpath to file system... '" + fileInClasspath + "' > '" + fileOnDisc + "'";
        this.logger.finer(msg);
        try {
            util.copyRessourceFileToFileSystem(fileInClasspath, fileOnDisc);
        } catch (Exception ex) {
            this.logger.log(Level.SEVERE, "Faile to do: " + msg, ex);
            msg = "Failed to copy example config file from classpath to file system...\n'" + fileInClasspath + "'\nto\n'" + fileOnDisc + "'";
            this.popError(msg);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.