Package org.apache.commons.vfs2

Examples of org.apache.commons.vfs2.FileName


        // TODO - use a hashtable when there are a large number of children
        FileObject[] children = getChildren();
        for (int i = 0; i < children.length; i++)
        {
            // final FileObject child = children[i];
            final FileName child = children[i].getName();
            // TODO - use a comparator to compare names
            // if (child.getName().getBaseName().equals(name))
            if (child.getBaseName().equals(name))
            {
                return resolveFile(child);
            }
        }
        return null;
View Full Code Here


     * @return The FileObject.
     * @throws FileSystemException if an error occurs.
     */
    public FileObject resolveFile(final String path) throws FileSystemException
    {
        final FileName otherName = getFileSystem().getFileSystemManager().resolveName(name, path);
        return fs.resolveFile(otherName);
    }
View Full Code Here

     */
    private void notifyParent(FileName childName, FileType newType) throws Exception
    {
        if (parent == null)
        {
            FileName parentName = name.getParent();
            if (parentName != null)
            {
                // Locate the parent, if it is cached
                parent = fs.getFileFromCache(parentName);
            }
View Full Code Here

            final String key = this.getClass().getName() + rootUrl.toString();
            FileSystem fs = findFileSystem(key, fileSystemOptions);
            if (fs == null)
            {
                String extForm = rootUrl.toExternalForm();
                final FileName rootName =
                    getContext().parseURI(extForm);
                // final FileName rootName =
                //    new BasicFileName(rootUrl, FileName.ROOT_PATH);
                fs = new UrlFileSystem(rootName, fileSystemOptions);
                addFileSystem(key, fs);
View Full Code Here

        throws ConfigurationException
    {
        try
        {
            FileSystemManager manager = VFS.getManager();
            FileName path;
            if (basePath != null)
            {
                FileName base = manager.resolveURI(basePath);
                path = manager.resolveName(base, fileName);
            }
            else
            {
                FileName file = manager.resolveURI(fileName);
                FileName base = file.getParent();
                path = manager.resolveName(base, file.getBaseName());
            }
            FileSystemOptions opts = getOptions(path.getScheme());
            FileObject file = (opts == null) ? manager.resolveFile(path.getURI())
                    : manager.resolveFile(path.getURI(), opts);
View Full Code Here

        try
        {
            FileSystemManager fsManager = VFS.getManager();
            if (url != null)
            {
                FileName name = fsManager.resolveURI(url.toString());
                if (name != null)
                {
                    return name.toString();
                }
            }

            if (UriParser.extractScheme(fileName) != null)
            {
                return fileName;
            }
            else if (basePath != null)
            {
                FileName base = fsManager.resolveURI(basePath);
                return fsManager.resolveName(base, fileName).getURI();
            }
            else
            {
                FileName name = fsManager.resolveURI(fileName);
                FileName base = name.getParent();
                return fsManager.resolveName(base, name.getBaseName()).getURI();
            }
        }
        catch (FileSystemException fse)
        {
View Full Code Here

            return super.getBasePath(path);
        }
        try
        {
            FileSystemManager fsManager = VFS.getManager();
            FileName name = fsManager.resolveURI(path);
            return name.getParent().getURI();
        }
        catch (FileSystemException fse)
        {
            fse.printStackTrace();
            return null;
View Full Code Here

            return super.getFileName(path);
        }
        try
        {
            FileSystemManager fsManager = VFS.getManager();
            FileName name = fsManager.resolveURI(path);
            return name.getBaseName();
        }
        catch (FileSystemException fse)
        {
            fse.printStackTrace();
            return null;
View Full Code Here

        }
        try
        {
            FileSystemManager fsManager = VFS.getManager();

            FileName path;
            if (basePath != null && UriParser.extractScheme(file) == null)
            {
                FileName base = fsManager.resolveURI(basePath);
                path = fsManager.resolveName(base, file);
            }
            else
            {
                path = fsManager.resolveURI(file);
View Full Code Here

            if (!file.exists())
            {
                return null;
            }
            FileName path = file.getName();
            URLStreamHandler handler = new VFSURLStreamHandler(path);
            return new URL(null, path.getURI(), handler);
        }
        catch (FileSystemException fse)
        {
            return null;
        }
View Full Code Here

TOP

Related Classes of org.apache.commons.vfs2.FileName

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.