dk.apaq.vfs.impl.ram
Class RamNode

java.lang.Object
  extended by dk.apaq.vfs.impl.ram.RamNode
All Implemented Interfaces:
Node, Serializable, Comparable
Direct Known Subclasses:
RamDirectory, RamFile

public class RamNode
extends Object
implements Node

See Also:
Serialized Form

Field Summary
protected  RamDirectory parent
           
 
Constructor Summary
RamNode(RamDirectory parent, String name)
           
 
Method Summary
 boolean canRead()
          Retrieves information about wether access to read is allowed.
 boolean canWrite()
          Retrieves information about wether access to read is allowed.
 int compareTo(Node node)
          Compare this node to another node by comparing their names.
 int compareTo(Object o)
           
 void delete()
          Deletes the node.
 boolean equals(Node node)
           
 String getBaseName()
          Retrieves the name without suffix like this: myimage.jpg = myimage mybundle.app = mybundle testfile.dit.dat = testfile.dit testdir = testdir
 FileSystem getFileSystem()
          Retrieves the filesystem which this node belongs to.
 Date getLastModified()
          Retrieves the date for last modification.
 String getName()
          Retrieves the name of the node.
 Directory getParent()
          Retrieves the parent directory of this node.
 Path getPath()
           
 String getSuffix()
          Retrieves the suffix of the node or null if no suffix, like this:.
 boolean isDirectory()
          Checks wether this node is a directory.
 boolean isFile()
          Checks wether this node is a file.
 boolean isHidden()
          Checks wether this node is hidden.
 void moveTo(Directory newParent)
          Moves this node to a new directory.
 void moveTo(Directory newParent, String newName)
          Moves this node to a new directory and renames it.
 void setLastModified(Date date)
          Sets the date for last modification.
 void setName(String name)
          Renames the node.
 URI toUri()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

protected RamDirectory parent
Constructor Detail

RamNode

public RamNode(RamDirectory parent,
               String name)
Method Detail

moveTo

public void moveTo(Directory newParent)
            throws IOException
Description copied from interface: Node
Moves this node to a new directory.

Specified by:
moveTo in interface Node
Parameters:
newParent - The directory the node should be moved to.
Throws:
IOException - Thrown if an error occurs while the node is being moved.

moveTo

public void moveTo(Directory newParent,
                   String newName)
            throws IOException
Description copied from interface: Node
Moves this node to a new directory and renames it.

Specified by:
moveTo in interface Node
Parameters:
newParent - The directory the node should be moved to.
newName - The new name of the node.
Throws:
IOException - Thrown if an error occurs while the node is being moved or renamed.

setName

public void setName(String name)
             throws IOException
Description copied from interface: Node
Renames the node.

Specified by:
setName in interface Node
Parameters:
name - The new name of the node.
Throws:
IOException - Thrown if an error occurs while renaming the node.

getName

public String getName()
Description copied from interface: Node
Retrieves the name of the node.

Specified by:
getName in interface Node
Returns:

getBaseName

public String getBaseName()
Description copied from interface: Node
Retrieves the name without suffix like this: myimage.jpg = myimage mybundle.app = mybundle testfile.dit.dat = testfile.dit testdir = testdir

Specified by:
getBaseName in interface Node
Returns:
The nodes basename.

getSuffix

public String getSuffix()
Description copied from interface: Node
Retrieves the suffix of the node or null if no suffix, like this:. myimage.jpg = jpg mybundle.app = app testfile.dit.dat = dat testdir =

Specified by:
getSuffix in interface Node
Returns:
The suffix or null.

getParent

public Directory getParent()
                    throws FileNotFoundException
Description copied from interface: Node
Retrieves the parent directory of this node.

Specified by:
getParent in interface Node
Returns:
The parent directory.
Throws:
FileNotFoundException - Thrown if parent directory could not be found - would normally only occur if called on the root directory.

getFileSystem

public FileSystem getFileSystem()
Description copied from interface: Node
Retrieves the filesystem which this node belongs to.

Specified by:
getFileSystem in interface Node
Returns:
The filesystem.

isDirectory

public boolean isDirectory()
Description copied from interface: Node
Checks wether this node is a directory.

Specified by:
isDirectory in interface Node
Returns:
True/False wether this node is a directory.

isFile

public boolean isFile()
Description copied from interface: Node
Checks wether this node is a file.

Specified by:
isFile in interface Node
Returns:
True/False wether this node is a file.

isHidden

public boolean isHidden()
Description copied from interface: Node
Checks wether this node is hidden.

Specified by:
isHidden in interface Node
Returns:
True/False if this node is hidden.

getLastModified

public Date getLastModified()
Description copied from interface: Node
Retrieves the date for last modification.

Specified by:
getLastModified in interface Node
Returns:
The date for alst modification.

setLastModified

public void setLastModified(Date date)
Description copied from interface: Node
Sets the date for last modification.

Specified by:
setLastModified in interface Node
Parameters:
date - The date.

compareTo

public int compareTo(Node node)
Description copied from interface: Node
Compare this node to another node by comparing their names.

Specified by:
compareTo in interface Node
Parameters:
node - The node to compare with.
Returns:
The returnvalue of the comparison of the to nodes names.

delete

public void delete()
            throws IOException
Description copied from interface: Node
Deletes the node.

Specified by:
delete in interface Node
Throws:
IOException - Thrown if an error occurs during deletion.

toUri

public URI toUri()
Specified by:
toUri in interface Node

equals

public boolean equals(Node node)
Specified by:
equals in interface Node

getPath

public Path getPath()
Specified by:
getPath in interface Node

canRead

public boolean canRead()
Description copied from interface: Node
Retrieves information about wether access to read is allowed. It should also check via the native filesystem if possible.

Specified by:
canRead in interface Node
Returns:
True/False

canWrite

public boolean canWrite()
Description copied from interface: Node
Retrieves information about wether access to read is allowed. It should also check via the native filesystem if possible.

Specified by:
canWrite in interface Node
Returns:
True/False

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable


Copyright © 2011. All Rights Reserved.