Example usage for org.apache.commons.vfs2.provider UriParser fixSeparators

List of usage examples for org.apache.commons.vfs2.provider UriParser fixSeparators

Introduction

In this page you can find the example usage for org.apache.commons.vfs2.provider UriParser fixSeparators.

Prototype

public static boolean fixSeparators(final StringBuilder name) 

Source Link

Document

Normalises the separators in a name.

Usage

From source file:cz.lbenda.rcp.config.ConfigurationFileProvider.java

@Override
public FileObject findFile(FileObject fileObject, String uri, FileSystemOptions fileSystemOptions)
        throws FileSystemException {
    final StringBuilder buffer = new StringBuilder(uri);
    UriParser.extractScheme(uri, buffer);
    UriParser.fixSeparators(buffer);

    UriParser.normalisePath(buffer);//from   w  w  w .  j  a v  a  2  s  . c om
    final String path = buffer.toString();

    FileSystemManager fsManager = VFS.getManager();
    return fsManager.resolveFile("file://" + configurationRW.configPath(path));
}

From source file:org.renjin.appengine.AppEngineLocalFilesSystemProvider.java

@Override
public FileObject findFile(FileObject baseFile, String uri, FileSystemOptions properties)
        throws FileSystemException {

    // Parse the name
    final StringBuilder buffer = new StringBuilder(uri);
    String scheme = UriParser.extractScheme(uri, buffer);
    if (scheme == null) {
        scheme = "file";
    }// ww w  . j  a  v a  2  s .c  om

    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) {
        final FileName rootName = getContext().parseURI(scheme + ":" + FileName.ROOT_PATH);

        filesystem = new AppEngineLocalFileSystem(rootName, rootFile.getAbsolutePath(), properties);
        addFileSystem(this, filesystem);
    }

    // Find the file
    return filesystem.resolveFile(path);
}

From source file:org.wso2.carbon.inbound.endpoint.protocol.file.MockFileNameParser.java

public FileName parseUri(VfsComponentContext context, FileName base, String filename)
        throws FileSystemException {
    StringBuilder name = new StringBuilder();
    String scheme = UriParser.extractScheme(filename.split("\\?")[0], name);
    if (scheme == null) {
        scheme = "test";
    }//from   www  .j  a  v a  2  s.  c o m

    UriParser.canonicalizePath(name, 0, name.length(), this);
    UriParser.fixSeparators(name);
    String rootFile = this.extractRootPrefix(filename, name);
    FileType fileType = UriParser.normalisePath(name);
    String path = name.toString();
    return new MockFileName(scheme, "", path, fileType);
}