本文整理汇总了Java中org.apache.commons.vfs.FileName.getURI方法的典型用法代码示例。如果您正苦于以下问题:Java FileName.getURI方法的具体用法?Java FileName.getURI怎么用?Java FileName.getURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.vfs.FileName
的用法示例。
在下文中一共展示了FileName.getURI方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFilename
import org.apache.commons.vfs.FileName; //导入方法依赖的package包/类
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
{
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;
}
示例2: getFilename
import org.apache.commons.vfs.FileName; //导入方法依赖的package包/类
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. //$NON-NLS-1$
if (root.startsWith("file:////")) return fileName.getURI(); // we'll see 4 forward slashes for a windows/smb network share
if (root.endsWith(":/")) // Windows //$NON-NLS-1$
{
root = root.substring(8,10);
}
else // *nix & OSX
{
root = ""; //$NON-NLS-1$
}
String fileString = root + fileName.getPath();
if (!"/".equals(Const.FILE_SEPARATOR)) //$NON-NLS-1$
{
fileString = Const.replace(fileString, "/", Const.FILE_SEPARATOR); //$NON-NLS-1$
}
return fileString;
}
示例3: AbstractFileSystem
import org.apache.commons.vfs.FileName; //导入方法依赖的package包/类
protected AbstractFileSystem(final FileName rootName,
final FileObject parentLayer,
final FileSystemOptions fileSystemOptions)
{
// this.parentLayer = parentLayer;
this.parentLayer = parentLayer;
this.rootName = rootName;
this.fileSystemOptions = fileSystemOptions;
FileSystemConfigBuilder builder = DefaultFileSystemConfigBuilder.getInstance();
String uri = builder.getRootURI(fileSystemOptions);
if (uri == null)
{
uri = rootName.getURI();
}
this.rootURI = uri;
}
示例4: getFilename
import org.apache.commons.vfs.FileName; //导入方法依赖的package包/类
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);
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;
}