当前位置: 首页>>代码示例>>Java>>正文


Java FileName.getRelativeName方法代码示例

本文整理汇总了Java中org.apache.commons.vfs2.FileName.getRelativeName方法的典型用法代码示例。如果您正苦于以下问题:Java FileName.getRelativeName方法的具体用法?Java FileName.getRelativeName怎么用?Java FileName.getRelativeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.vfs2.FileName的用法示例。


在下文中一共展示了FileName.getRelativeName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createFile

import org.apache.commons.vfs2.FileName; //导入方法依赖的package包/类
/**
 * Creates a file object.  This method is called only if the requested
 * file is not cached.
 */
@Override
protected FileObject createFile(final AbstractFileName name) throws Exception
{
    // Find the file that the name points to
    final FileName junctionPoint = getJunctionForFile(name);
    final FileObject file;
    if (junctionPoint != null)
    {
        // Resolve the real file
        final FileObject junctionFile = junctions.get(junctionPoint);
        final String relName = junctionPoint.getRelativeName(name);
        file = junctionFile.resolveFile(relName, NameScope.DESCENDENT_OR_SELF);
    }
    else
    {
        file = null;
    }

    // Return a wrapper around the file
    return new DelegateFileObject(name, this, file);
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:26,代码来源:VirtualFileSystem.java

示例2: testRelName

import org.apache.commons.vfs2.FileName; //导入方法依赖的package包/类
/**
 * Checks that a file name converts to an expected relative path
 */
private void testRelName(final FileName baseName,
                         final String relPath)
    throws Exception
{
    final FileName expectedName = getManager().resolveName(baseName, relPath);

    // Convert to relative path, and check
    final String actualRelPath = baseName.getRelativeName(expectedName);
    assertEquals(relPath, actualRelPath);
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:14,代码来源:NamingTests.java

示例3: pathFromRoot

import org.apache.commons.vfs2.FileName; //导入方法依赖的package包/类
/**
 * @param file the file
 * @return the full path
 */
public final String pathFromRoot(FileObject file) {
    FileName rootFolderName = rootFolder.getName();
    FileName fileName = file.getName();
    try {
        return rootFolderName.getRelativeName(fileName);
    } catch (FileSystemException e) {
        throw new AutomationException("Error resolving relative path " +
                rootFolderName.getPath() + " -> " + fileName.getPath(), e);
    }
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:15,代码来源:FileServiceConfiguration.java


注:本文中的org.apache.commons.vfs2.FileName.getRelativeName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。