本文整理汇总了Java中org.apache.commons.vfs.FileName.getRootURI方法的典型用法代码示例。如果您正苦于以下问题:Java FileName.getRootURI方法的具体用法?Java FileName.getRootURI怎么用?Java FileName.getRootURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.vfs.FileName
的用法示例。
在下文中一共展示了FileName.getRootURI方法的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: 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;
}
示例4: resolveFile
import org.apache.commons.vfs.FileName; //导入方法依赖的package包/类
private synchronized FileObject resolveFile(final FileName name, final boolean useCache) throws FileSystemException
{
if (!rootName.getRootURI().equals(name.getRootURI()))
{
throw new FileSystemException("vfs.provider/mismatched-fs-for-name.error",
new Object[]{
name, rootName, name.getRootURI()});
}
// [email protected] ==> use getFileFromCache
FileObject file;
if (useCache)
{
file = getFileFromCache(name);
}
else
{
file = null;
}
// FileObject file = (FileObject) files.get(name);
if (file == null)
{
try
{
synchronized (this)
{
file = createFile(name);
}
}
catch (Exception e)
{
throw new FileSystemException("vfs.provider/resolve-file.error", name, e);
}
file = decorateFileObject(file);
// [email protected] ==> use putFileToCache
if (useCache)
{
putFileToCache(file);
}
// files.put(name, file);
}
/**
* resync the file information if requested
*/
if (getFileSystemManager().getCacheStrategy().equals(CacheStrategy.ON_RESOLVE))
{
file.refresh();
}
return file;
}