List of usage examples for org.apache.commons.vfs FileName getRootURI
public String getRootURI();
From source file:com.panet.imeta.core.vfs.KettleVFS.java
public static String getFilename(FileObject fileObject) { FileName fileName = fileObject.getName(); String root = fileName.getRootURI(); if (!root.startsWith("file:")) return fileName.getURI(); // nothing we can do about non-normal files. if (root.endsWith(":/")) // Windows {/* ww w. j av a 2s . c o m*/ root = root.substring(8, 10); } else // *nix & OSX { root = ""; } String fileString = root + fileName.getPath(); if (!"/".equals(Const.FILE_SEPARATOR)) { fileString = Const.replace(fileString, "/", Const.FILE_SEPARATOR); } return fileString; }
From source file:com.panet.imeta.trans.steps.accessinput.AccessInputMeta.java
public static String getFilename(FileObject fileObject) { FileName fileName = fileObject.getName(); String root = fileName.getRootURI(); if (!root.startsWith("file:")) return fileName.getURI(); if (root.endsWith(":/")) root = root.substring(8, 10);/*from ww w .ja v a2 s . com*/ else root = root.substring(7, root.length() - 1); String fileString = root + fileName.getPath(); if (!"/".equals(Const.FILE_SEPARATOR)) fileString = Const.replace(fileString, "/", Const.FILE_SEPARATOR); return fileString; }
From source file:org.pentaho.di.core.vfs.KettleVFS.java
public static String getFilename(FileObject fileObject) { FileName fileName = fileObject.getName(); String root = fileName.getRootURI(); if (!root.startsWith("file:")) { return fileName.getURI(); // nothing we can do about non-normal files. }/*from w w w . ja v a2 s . co m*/ if (root.startsWith("file:////")) { return fileName.getURI(); // we'll see 4 forward slashes for a windows/smb network share } if (root.endsWith(":/")) { // Windows root = root.substring(8, 10); } else { // *nix & OSX root = ""; } String fileString = root + fileName.getPath(); if (!"/".equals(Const.FILE_SEPARATOR)) { fileString = Const.replace(fileString, "/", Const.FILE_SEPARATOR); } return fileString; }
From source file:org.pentaho.di.trans.steps.accessinput.AccessInputMeta.java
public static String getFilename(FileObject fileObject) { FileName fileName = fileObject.getName(); String root = fileName.getRootURI(); if (!root.startsWith("file:")) { return fileName.getURI(); }// w w w .j a v a 2 s. c om if (root.endsWith(":/")) { root = root.substring(8, 10); } else { root = root.substring(7, root.length() - 1); } String fileString = root + fileName.getPath(); if (!"/".equals(Const.FILE_SEPARATOR)) { fileString = Const.replace(fileString, "/", Const.FILE_SEPARATOR); } return fileString; }
From source file:org.pentaho.di.trans.steps.hadoopfileinput.HadoopFileInputMeta.java
public String getUrlPath(String incomingURL) { String path = null;//from w w w . j a va 2s . co m try { String noVariablesURL = incomingURL.replaceAll("[${}]", "/"); UrlFileNameParser parser = new UrlFileNameParser(); FileName fileName = parser.parseUri(null, null, noVariablesURL); String root = fileName.getRootURI(); path = incomingURL.substring(root.length() - 1); } catch (FileSystemException e) { path = null; } return path; }