Example usage for org.apache.commons.vfs2 FileType FILE_OR_FOLDER

List of usage examples for org.apache.commons.vfs2 FileType FILE_OR_FOLDER

Introduction

In this page you can find the example usage for org.apache.commons.vfs2 FileType FILE_OR_FOLDER.

Prototype

FileType FILE_OR_FOLDER

To view the source code for org.apache.commons.vfs2 FileType FILE_OR_FOLDER.

Click Source Link

Document

A file or folder.

Usage

From source file:net.sf.jabb.web.action.VfsTreeAction.java

/**
 * Populate a node./* www. j  a v  a2s.  c o  m*/
 * @param root      Relative root directory.
 * @param file      The file object.
 * @return   The node data structure which presents the file.
 * @throws FileSystemException
 */
protected JsTreeNodeData populateTreeNodeData(FileObject root, FileObject file) throws FileSystemException {
    boolean noChild = true;
    FileType type = file.getType();
    if (type.equals(FileType.FOLDER) || type.equals(FileType.FILE_OR_FOLDER)) {
        noChild = file.getChildren().length == 0;
    }
    String relativePath = root.getName().getRelativeName(file.getName());
    return populateTreeNodeData(file, noChild, relativePath);
}

From source file:org.codehaus.mojo.vfs.internal.DefaultVfsDirectoryScanner.java

private boolean isDirectory(FileObject file) throws FileSystemException {
    if (FileType.FOLDER == file.getType()) {
        return true;
    }/*  w  w w. j  a v a 2  s .  c  o  m*/

    if (FileType.FILE_OR_FOLDER == file.getType()) {
        try {
            file.getChildren();
        } catch (FileNotFolderException e) {
            return false;
        }

        return true;
    }

    return false;
}