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


Java UriParser.normalisePath方法代码示例

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


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

示例1: parseUri

import org.apache.commons.vfs2.provider.UriParser; //导入方法依赖的package包/类
@Override
public FileName parseUri(final VfsComponentContext context, final FileName base,
                         final String filename) throws FileSystemException
{
    final StringBuilder name = new StringBuilder();

    // Extract the scheme and authority parts
    final Authority auth = extractToPath(filename, name);

    // extract domain
    String username = auth.getUserName();
    final String domain = extractDomain(username);
    if (domain != null)
    {
        username = username.substring(domain.length() + 1);
    }

    // Decode and adjust separators
    UriParser.canonicalizePath(name, 0, name.length(), this);
    UriParser.fixSeparators(name);


    // Normalise the path.  Do this after extracting the share name,
    // to deal with things like Nfs://hostname/share/..
    final FileType fileType = UriParser.normalisePath(name);
    final String path = name.toString();

    return new NfsFileName(
        auth.getScheme(),
        auth.getHostName(),
        auth.getPort(),
        username,
        auth.getPassword(),
        path,
        fileType);
}
 
开发者ID:danniss,项目名称:common-vfs2-nfs,代码行数:37,代码来源:NfsFileNameParser.java

示例2: parseUri

import org.apache.commons.vfs2.provider.UriParser; //导入方法依赖的package包/类
public FileName parseUri(final VfsComponentContext context, FileName base, final String filename)
    throws FileSystemException
{
    final StringBuilder name = new StringBuilder();

    // Extract the scheme
    String scheme = UriParser.extractScheme(filename, name);
    if (scheme == null)
    {
        scheme = "file";
    }

    // Remove encoding, and adjust the separators
    UriParser.canonicalizePath(name, 0, name.length(), this);

    UriParser.fixSeparators(name);

    // Extract the root prefix
    final String rootFile = extractRootPrefix(filename, name);

    // Normalise the path
    FileType fileType = UriParser.normalisePath(name);

    final String path = name.toString();

    return createFileName(
        scheme,
        rootFile,
        path,
        fileType);
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:32,代码来源:LocalFileNameParser.java

示例3: findFile

import org.apache.commons.vfs2.provider.UriParser; //导入方法依赖的package包/类
/**
 * Locates a file object, by absolute URI.
 * @param baseFile The base FileObject.
 * @param uri The URI of the file to be located.
 * @param properties FileSystemOptions to use to locate or create the file.
 * @return The FileObject.
 * @throws FileSystemException if an error occurs.
 */
public synchronized FileObject findFile(final FileObject baseFile, final String uri,
                                        final FileSystemOptions properties)
    throws FileSystemException
{
    // Parse the name
    final StringBuilder buffer = new StringBuilder(uri);
    final String scheme = UriParser.extractScheme(uri, buffer);

    UriParser.fixSeparators(buffer);

    FileType fileType = UriParser.normalisePath(buffer);
    final String path = buffer.toString();

    // Create the temp file system if it does not exist
    // FileSystem filesystem = findFileSystem( this, (Properties) null);
    FileSystem filesystem = findFileSystem(this, properties);
    if (filesystem == null)
    {
        if (rootFile == null)
        {
            rootFile = getContext().getTemporaryFileStore().allocateFile("tempfs");
        }
        final FileName rootName =
            getContext().parseURI(scheme + ":" + FileName.ROOT_PATH);
        // final FileName rootName =
        //    new LocalFileName(scheme, scheme + ":", FileName.ROOT_PATH);
        filesystem = new LocalFileSystem(rootName, rootFile.getAbsolutePath(), properties);
        addFileSystem(this, filesystem);
    }

    // Find the file
    return filesystem.resolveFile(path);
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:42,代码来源:TemporaryFileProvider.java

示例4: parseUri

import org.apache.commons.vfs2.provider.UriParser; //导入方法依赖的package包/类
@Override
public FileName parseUri(final VfsComponentContext context, FileName base, final String filename) throws FileSystemException
{
    final StringBuilder name = new StringBuilder();

    // Extract the scheme and authority parts
    final Authority auth = extractToPath(filename, name);

    // extract domain
    String username = auth.getUserName();
    String domain = extractDomain(username);
    if (domain != null)
    {
        username = username.substring(domain.length() + 1);
    }

    // Decode and adjust separators
    UriParser.canonicalizePath(name, 0, name.length(), this);
    UriParser.fixSeparators(name);

    // Extract the share
    final String share = UriParser.extractFirstElement(name);
    if (share == null || share.length() == 0)
    {
        throw new FileSystemException("vfs.provider.smb/missing-share-name.error", filename);
    }

    // Normalise the path.  Do this after extracting the share name,
    // to deal with things like smb://hostname/share/..
    FileType fileType = UriParser.normalisePath(name);
    final String path = name.toString();

    return new SmbFileName(
        auth.getScheme(),
        auth.getHostName(),
        auth.getPort(),
        username,
        auth.getPassword(),
        domain,
        share,
        path,
        fileType);
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:44,代码来源:SmbFileNameParser.java


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