List of usage examples for java.io File separator
String separator
To view the source code for java.io File separator.
Click Source Link
From source file:controller.NewEntryVideoControllerTest.java
@AfterClass public static void tearDownClass() { String fSeparator = File.separator; File file = new File("." + fSeparator + "MyDiaryBook" + fSeparator); try {// w ww .j av a2s. co m FileUtils.deleteDirectory(file); } catch (IOException ex) { Logger.getLogger(NewEntryVideoControllerTest.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:Main.java
private static String listToString(ArrayList<String> pathSpec) { if (pathSpec.isEmpty()) return ""; StringBuilder ret = new StringBuilder(); ret.append(pathSpec.get(0));//from ww w .j av a 2 s . c om for (int i = 1, n = pathSpec.size(); i < n; i++) ret.append(File.separator).append(pathSpec.get(i)); return ret.toString(); }
From source file:avantssar.aslanpp.testing.HTMLHelper.java
public static String removePrefix(File root, File f) { String fNorm = FilenameUtils.normalize(f.getAbsolutePath()); String relativePath = fNorm;//w w w . ja va 2s .c o m if (root.isDirectory()) { String rootNorm = FilenameUtils.normalizeNoEndSeparator(root.getAbsolutePath()) + File.separator; if (relativePath.startsWith(rootNorm)) { relativePath = relativePath.substring(rootNorm.length()); } } return relativePath; }
From source file:io.trivium.anystore.StoreUtils.java
public static void cleanStore() { Logger logger = Logger.getLogger(StoreUtils.class.getName()); logger.info("cleaning persistence store"); String path = Central.getProperty("basePath"); if (!path.endsWith(File.separator)) path += File.separator;//from w w w . j av a 2s. com path += "store" + File.separator; try { File f = new File(path + meta); if (f.exists()) FileUtils.deleteQuietly(f); } catch (Exception e1) { logger.log(Level.SEVERE, "cleaning meta store failed", e1); } try { File f = new File(path + data); if (f.exists()) FileUtils.deleteQuietly(f); } catch (Exception e1) { logger.log(Level.SEVERE, "cleaning data store failed", e1); } try { File f = new File(path + local); if (f.exists()) FileUtils.deleteQuietly(f); } catch (Exception e1) { logger.log(Level.SEVERE, "cleaning local store failed", e1); } }
From source file:Main.java
public static boolean copyFile(File src, File tar) throws Exception { if (src.isFile()) { InputStream is = new FileInputStream(src); OutputStream op = new FileOutputStream(tar); BufferedInputStream bis = new BufferedInputStream(is); BufferedOutputStream bos = new BufferedOutputStream(op); byte[] bt = new byte[1024 * 8]; int len = bis.read(bt); while (len != -1) { bos.write(bt, 0, len);/* www . j a v a2 s. c o m*/ len = bis.read(bt); } bis.close(); bos.close(); } if (src.isDirectory()) { File[] f = src.listFiles(); tar.mkdir(); for (int i = 0; i < f.length; i++) { copyFile(f[i].getAbsoluteFile(), new File(tar.getAbsoluteFile() + File.separator + f[i].getName())); } } return true; }
From source file:net.orpiske.sdm.common.WorkdirUtils.java
/** * Gets the work dir//from w w w . j a v a2s. c o m * @return the work dir */ public static String getWorkDir() { return config.getString("temp.work.dir", FileUtils.getTempDirectoryPath() + File.separator + "work"); }
From source file:ch.oakmountain.tpa.web.TpaPersistorUtils.java
public static void copyFromResourceToDir(String fileName, String outputDir, String prefix) throws IOException { String content = IOUtils.toString( TpaWebPersistor.class.getResourceAsStream(File.separator + prefix + File.separator + fileName)); FileUtils.writeStringToFile(new File(outputDir + File.separator + prefix + File.separator + fileName), content);//from w ww .j av a 2 s. c o m }
From source file:com.gagein.util.FileUtils.java
public static boolean createDir(String destDirName) { File dir = new File(destDirName); if (dir.exists()) { logger.debug("========" + destDirName + "========?========"); return true; }/*from w w w . j a v a 2 s. com*/ if (!destDirName.endsWith(File.separator)) { destDirName = destDirName + File.separator; } // if (dir.mkdirs()) { logger.debug("========" + destDirName + "========??========"); return true; } else { logger.debug("========" + destDirName + "========?========"); return false; } }
From source file:cz.cuni.mff.peckam.ais.statistics.IonogramStatistics.java
/** * @param args 0 => Orbit base dir, 1 => min orbit, 2 => max orbit * @throws IOException On IO error./* ww w .ja va2 s . co m*/ */ public static void main(String[] args) throws IOException { final File orbitDir = new File(args[0]); final int minOrbit = Integer.parseInt(args[1]); final int maxOrbit = Integer.parseInt(args[2]); try (final BufferedWriter meanWriter = new BufferedWriter(new FileWriter("mean")); final BufferedWriter sdWriter = new BufferedWriter(new FileWriter("sd")); final BufferedWriter maxWriter = new BufferedWriter(new FileWriter("max")); final BufferedWriter featuresWriter = new BufferedWriter(new FileWriter("features")); final BufferedWriter traceWriter = new BufferedWriter(new FileWriter("trace"))) { final IonogramStatistics stats = new IonogramStatistics(meanWriter, sdWriter, maxWriter, featuresWriter, traceWriter); for (int i = minOrbit; i <= maxOrbit; i++) { final File orbitFile = new File(orbitDir, (i + "").replaceAll(".$", "X") + File.separator + "FRM_AIS_RDR_" + i + ".LBL"); if (orbitFile.exists()) { stats.execute(orbitFile); } } } System.out.println("Minimal value: " + min); }
From source file:Main.java
public static String getElementTypeFolder(String rootFolder, String namespace, String elementTypeId) { return getNamespaceFolder(rootFolder, namespace) + File.separator + elementTypeId; }