Example usage for org.apache.commons.vfs.provider.url UrlFileNameParser parseUri

List of usage examples for org.apache.commons.vfs.provider.url UrlFileNameParser parseUri

Introduction

In this page you can find the example usage for org.apache.commons.vfs.provider.url UrlFileNameParser parseUri.

Prototype

public FileName parseUri(final VfsComponentContext context, final FileName base, final String filename)
            throws FileSystemException 

Source Link

Usage

From source file:org.pentaho.di.trans.steps.hadoopfileinput.HadoopFileInputMeta.java

public String getUrlPath(String incomingURL) {
    String path = null;// ww w.ja  va  2 s . c o  m
    try {
        String noVariablesURL = incomingURL.replaceAll("[${}]", "/");
        UrlFileNameParser parser = new UrlFileNameParser();
        FileName fileName = parser.parseUri(null, null, noVariablesURL);
        String root = fileName.getRootURI();
        path = incomingURL.substring(root.length() - 1);
    } catch (FileSystemException e) {
        path = null;
    }
    return path;
}