/** * Method description * * * @param file * * @throws IOException */ public static void delete(File file) throws IOException { delete(file, false); }
/** * Method description * * * @param directory * * @throws IOException */ @Override public void create(File directory) throws IOException { if (logger.isInfoEnabled()) { logger.info("create directory {}", directory.getPath()); } IOUtil.mkdirs(directory); }
/** * Method description * * * @param reader * @param writer * * @throws IOException */ public static void copy(Reader reader, Writer writer) throws IOException { copy(reader, writer, DEFAULT_BUFFERSIZE); }
/** * Method description * * * @param archive * @param outputDirectory * @param force * * @throws IOException */ @Override public void extract(File archive, File outputDirectory, boolean force) throws IOException { if (!outputDirectory.exists()) { IOUtil.mkdirs(outputDirectory); extractAndCreateProperties(archive, outputDirectory); } else if (force || isModified(archive, outputDirectory)) { IOUtil.delete(outputDirectory); IOUtil.mkdirs(outputDirectory); extractAndCreateProperties(archive, outputDirectory); } }
/** * * * @param cmd * * @return */ public static String search(String cmd) { return search(DEFAULT_PATH, cmd, DEFAULT_CHECKPARAMETER); }
/** * Method description * * * @return */ @Override public List<String> getPythonInstallations() { return IOUtil.searchAll(COMMAND_PYTHON); } }
/** * Method description * * * @param basePath * * @since 1.6 * @return */ public static File getScript(String basePath) { return getScript(new File(basePath), basePath); }
/** * Method description * * * * @param baseDirectory * @param directory * @return * * @throws IOException */ public static String getRepositoryName(File baseDirectory, File directory) throws IOException { String name = null; String path = directory.getCanonicalPath(); int directoryLength = baseDirectory.getCanonicalPath().length(); if (directoryLength < path.length()) { name = IOUtil.trimSeperatorChars(path.substring(directoryLength)); // replace windows path seperator name = name.replaceAll("\\\\", "/"); } else if (logger.isWarnEnabled()) { logger.warn("path is shorter as the main repository path"); } return name; }
/** * Method description * * * @param archive * @param outputDirectory * * @throws IOException */ public static void extract(File archive, File outputDirectory) throws IOException { String name = archive.getName().toLowerCase(Locale.ENGLISH); extract(archive, outputDirectory, name); }
/** * Method description * * * @param in * @param out * * @throws IOException */ public static void copy(InputStream in, OutputStream out) throws IOException { copy(in, out, DEFAULT_BUFFERSIZE); }
/** * Method description * * * @param archive * @param outputDirectory * @param force * * @throws IOException */ @Override public void extract(File archive, File outputDirectory, boolean force) throws IOException { if (!outputDirectory.exists()) { IOUtil.mkdirs(outputDirectory); extractAndCreateProperties(archive, outputDirectory); } else if (force || isModified(archive, outputDirectory)) { IOUtil.delete(outputDirectory); IOUtil.mkdirs(outputDirectory); extractAndCreateProperties(archive, outputDirectory); } }
/** * * * @param path * @param cmd * * @return */ public static String search(String[] path, String cmd) { return search(path, cmd, DEFAULT_CHECKPARAMETER); }
/** * Method description * * * @param cmd * * @return */ public static List<String> searchAll(String cmd) { return searchAll(DEFAULT_PATH, cmd, DEFAULT_CHECKPARAMETER); }