uk.ac.starlink.connect
Class FileBranch

java.lang.Object
  extended by uk.ac.starlink.connect.FileNode
      extended by uk.ac.starlink.connect.FileBranch
All Implemented Interfaces:
Branch, Node

public class FileBranch
extends FileNode
implements Branch

Branch representing a directory file.

Since:
18 Feb 2005

Constructor Summary
FileBranch(File dir)
          Constructs a branch from a File object representing an existing directory.
 
Method Summary
 Node createNode(String location)
          Attempts to construct a new node in the context of this one.
 Node[] getChildren()
          Returns the array of child nodes belonging to this branch.
 boolean isHidingEnabled()
          Indicates whether files marked as hidden by the default FileSystemView are shown or not.
 void setHidingEnabled(boolean hiding)
          Sets whether files marked as hidden by the default FileSystemView are shown or not.
 
Methods inherited from class uk.ac.starlink.connect.FileNode
createNode, equals, getFile, getName, getParent, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface uk.ac.starlink.connect.Node
getName, getParent
 

Constructor Detail

FileBranch

public FileBranch(File dir)
Constructs a branch from a File object representing an existing directory.

Parameters:
dir - directory
Throws:
IllegalArgumentException - if dir is not a directory
Method Detail

getChildren

public Node[] getChildren()
Description copied from interface: Branch
Returns the array of child nodes belonging to this branch. All the returned values represent file objects which actuallly exist in the filesystem.

Specified by:
getChildren in interface Branch
Returns:
child nodes of this one

createNode

public Node createNode(String location)
Description copied from interface: Branch
Attempts to construct a new node in the context of this one. The new item may represent a new or an existing node in the filesystem. This call should not in itself perform any write operations on the filesystem (such as creating a node which doesn't currently exist), though a subsequent Leaf.getOutputStream() call may do so.

The returned node will typically be a child of this branch, but need not be, for instance if name is interpreted as an absolute path.

If the named node cannot be created, null may be returned.

Specified by:
createNode in interface Branch
Parameters:
location - name of a node in the context of this branch
Returns:
node representing the location of an existing or new node

isHidingEnabled

public boolean isHidingEnabled()
Indicates whether files marked as hidden by the default FileSystemView are shown or not.

Returns:
true if hidden files are not shown

setHidingEnabled

public void setHidingEnabled(boolean hiding)
Sets whether files marked as hidden by the default FileSystemView are shown or not. The default is true.

Parameters:
hiding - true to hide hidden files

Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved.