Java Code Examples for org.apache.commons.vfs2.provider.UriParser#decode()

The following examples show how to use org.apache.commons.vfs2.provider.UriParser#decode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocalFile.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the URI of the file.
 *
 * @return The URI of the file.
 */
@Override
public String toString() {
    try {
        // VFS-325: URI may contain percent-encoded values as part of file name, so decode
        // those characters before returning
        return UriParser.decode(getName().getURI());
    } catch (final FileSystemException e) {
        return getName().getURI();
    }
}
 
Example 2
Source File: LocalFileName.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the decoded URI of the file.
 *
 * @return the FileName as a URI.
 */
@Override
public String toString() {
    try {
        return UriParser.decode(super.getURI());
    } catch (final FileSystemException e) {
        return super.getURI();
    }
}
 
Example 3
Source File: FtpFileObject.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
protected FtpFileObject(final AbstractFileName name, final FtpFileSystem fileSystem, final FileName rootName)
        throws FileSystemException {
    super(name, fileSystem);
    final String relPath = UriParser.decode(rootName.getRelativeName(name));
    if (".".equals(relPath)) {
        // do not use the "." as path against the ftp-server
        // e.g. the uu.net ftp-server do a recursive listing then
        // this.relPath = UriParser.decode(rootName.getPath());
        // this.relPath = ".";
        this.relPath = null;
    } else {
        this.relPath = relPath;
    }
}
 
Example 4
Source File: ResourceFileName.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the decoded URI of the file.
 *
 * @return the FileName as a URI.
 */
@Override
public String toString() {
    try {
        return UriParser.decode(super.getURI());
    } catch (final FileSystemException e) {
        return super.getURI();
    }
}
 
Example 5
Source File: SftpFileObject.java    From commons-vfs with Apache License 2.0 4 votes vote down vote up
protected SftpFileObject(final AbstractFileName name, final SftpFileSystem fileSystem) throws FileSystemException {
    super(name, fileSystem);
    relPath = UriParser.decode(fileSystem.getRootName().getRelativeName(name));
}
 
Example 6
Source File: DefaultFileReplicator.java    From commons-vfs with Apache License 2.0 2 votes vote down vote up
/**
 * Create the temporary file.
 *
 * @param parent The file to use as the parent of the file being created.
 * @param name The name of the file to create.
 * @return The File that was created.
 * @throws FileSystemException if an error occurs creating the file.
 */
protected File createFile(final File parent, final String name) throws FileSystemException {
    return new File(parent, UriParser.decode(name));
}