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:com.hangum.tadpole.commons.utils.zip.util.ZipUtils.java
public static String pack(String fullPath) throws Exception { int intlastSep = fullPath.lastIndexOf(File.separator); String base_dir = fullPath.substring(0, intlastSep); String zipFile = fullPath.substring(intlastSep + 1); return pack(base_dir, zipFile); }
From source file:Main.java
public static String getDirectory(Context context) { return context.getExternalCacheDir() + File.separator + "NightMode"; }
From source file:Main.java
public static String getElementFile(String rootFolder, String namespace, String elementTypeId, String elementId) {/*from w ww. ja v a2 s.c o m*/ return getElementTypeFolder(rootFolder, namespace, elementTypeId) + File.separator + elementId + ".xml"; }
From source file:Main.java
public static String getOutputCsvFolder(String appName) { String outputFolder = getOutputFolder(appName); String result = outputFolder + File.separator + CSV_FOLDER_NAME; return result; }
From source file:Main.java
public static String getDirectoryForFile(String filepath) { int i = filepath.lastIndexOf(File.separator); if (i == -1)/*from w w w . j ava 2s. c o m*/ return filepath; else return filepath.substring(0, i); }
From source file:Main.java
/** * Creates W3C DOM Document object from XML file * @param filePath path to xml file including file name and extension *///from w w w. ja v a2s. c o m public static Document parseXml(String filePath) { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(filePath); doc.getDocumentElement().normalize(); return doc; } catch (ParserConfigurationException pce) { pce.printStackTrace(); return null; } catch (SAXException se) { se.printStackTrace(); return null; } catch (IOException ioe) { //ioe.printStackTrace(); String toRemove = File.separator + "WebApp" + File.separator; Document doc; try { DocumentBuilder db = dbf.newDocumentBuilder(); doc = db.parse(filePath.replace(toRemove, File.separator)); doc.getDocumentElement().normalize(); return doc; } catch (SAXException saxex) { saxex.printStackTrace(); return null; } catch (ParserConfigurationException pcex) { pcex.printStackTrace(); return null; } catch (IOException ioex) { ioex.printStackTrace(); return null; } } }
From source file:Main.java
public static void upZipFile(File zipFile, String folderPath) { ZipFile zf;/*from w ww .j a va2s . co m*/ try { zf = new ZipFile(zipFile); for (Enumeration<?> entries = zf.entries(); entries.hasMoreElements();) { ZipEntry entry = ((ZipEntry) entries.nextElement()); if (entry.isDirectory()) { String dirstr = entry.getName(); dirstr = new String(dirstr.getBytes("8859_1"), "GB2312"); File f = new File(dirstr); f.mkdir(); continue; } InputStream in = zf.getInputStream(entry); String str = folderPath + File.separator + entry.getName(); str = new String(str.getBytes("8859_1"), "GB2312"); File desFile = new File(str); if (!desFile.exists()) { File fileParentDir = desFile.getParentFile(); if (!fileParentDir.exists()) { fileParentDir.mkdirs(); } desFile.createNewFile(); } OutputStream out = new FileOutputStream(desFile); byte buffer[] = new byte[BUFF_SIZE]; int realLength; while ((realLength = in.read(buffer)) > 0) { out.write(buffer, 0, realLength); } in.close(); out.close(); } } catch (ZipException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.domnian.BotConfiguration.java
public static void writeDefault(String fileName) throws Exception { writeDefault(new File(System.getProperty("user.dir") + File.separator + fileName)); }
From source file:Main.java
public static String getInstancesFolder(String appName, String tableId) { String path;/*from www .ja va 2 s.c o m*/ path = getTablesFolder(appName, tableId) + File.separator + INSTANCES_FOLDER_NAME; File f = new File(path); f.mkdirs(); return f.getAbsolutePath(); }
From source file:ch.unibas.fittingwizard.infrastructure.base.ResourceUtils.java
public static String getRelativePath(String targetPath, String basePath) { logger.info(targetPath + "\tand\t" + basePath); return getRelativePath(targetPath, basePath, File.separator); }