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

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

Introduction

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

Prototype

public static String decode(final String encodedStr) throws FileSystemException 

Source Link

Document

Removes %nn encodings from a string.

Usage

From source file:fr.cls.atoll.motu.library.misc.vfs.provider.gsiftp.GsiFtpFileObject.java

/**
 * Instantiates a new gsi ftp file object.
 * //from   w ww. j a v  a2  s .c o  m
 * @param name the name
 * @param fileSystem the file system
 * @param rootName the root name
 * 
 * @throws FileSystemException the file system exception
 */
protected GsiFtpFileObject(final AbstractFileName name, final GsiFtpFileSystem fileSystem,
        final FileName rootName) throws FileSystemException {
    super(name, fileSystem);
    ftpFs = fileSystem;
    String relPathTmp = UriParser.decode(rootName.getRelativeName(name));

    // log.debug("FileName=" + name + " Root=" + rootName
    // + " Relative path=" + relPath );

    if (".".equals(relPathTmp)) {
        // 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 = ".";
        // boolean ok = true;
        // try {
        // cwd = ftpFs.getClient().getCurrentDir();
        // }
        // catch (ServerException se) { ok = false;}
        // catch (IOException se) { ok = false;}

        // if ( ! ok ) {
        // throw new FileSystemException("vfs.provider.gsiftp/get-type.error", getName());
        // }
        this.relPath = "/"; // cwd;
    } else {
        this.relPath = relPathTmp;
    }
}

From source file:fr.cls.atoll.motu.library.misc.vfs.provider.gsiftp.GsiFtpFileObject.java

/**
 * Fetches the info for this file.//from w w w .  j a  v a2s  . c o  m
 * 
 * @param flush the flush
 * 
 * @throws IOException Signals that an I/O exception has occurred.
 */
private void getInfo(boolean flush) throws IOException {
    final GsiFtpFileObject parent = (GsiFtpFileObject) getParent();
    FileInfo newFileInfo = null;

    if (parent != null) {
        newFileInfo = parent.getChildFile(UriParser.decode(getName().getBaseName()), flush);
    } else {
        // Assume the root is a directory and exists
        newFileInfo = new FileInfo();

        // GridFTTP Only runs in UNIX so this would be OK
        newFileInfo.setName("/");
        newFileInfo.setFileType(FileInfo.DIRECTORY_TYPE);
    }

    this.fileInfo = newFileInfo;
}

From source file:fr.cls.atoll.motu.library.misc.vfs.provider.gsiftp.GsiFtpFileObject.java

/**
 * Called when the children of this file change.
 * /*from ww  w  .  j  a  va 2 s  . c om*/
 * @param child the child
 * @param newType the new type
 */
@Override
protected void onChildrenChanged(FileName child, FileType newType) {
    if (children != null && newType.equals(FileType.IMAGINARY)) {
        try {
            children.remove(UriParser.decode(child.getBaseName()));
        } catch (FileSystemException e) {
            throw new RuntimeException(e.getMessage());
        }
    } else {
        // if child was added we have to rescan the children
        // TODO - get rid of this
        children = null;
    }
}