com.metamatrix.common.tree.directory
Interface DirectoryEntry

All Superinterfaces:
java.lang.Comparable, PropertiedObject, TreeNode
All Known Implementing Classes:
FileSystemEntry, PreviewableDirectoryEntry

public interface DirectoryEntry
extends TreeNode

This interface represents a single resource on a hierarchical system, such as a file system.


Field Summary
static FileDefinition TYPE_FILE
           
static FolderDefinition TYPE_FOLDER
           
 
Method Summary
 boolean canRead()
          Return whether it is possible to read from this DirectoryEntry, and whether an input stream can be obtained for this entry.
 boolean canWrite()
          Return whether it is possible to write to this DirectoryEntry, and whether an output stream can be obtained for this entry.
 java.io.InputStream getInputStream()
          If this DirectoryEntry is readable, then return an InputStream instance to the resource represented by this entry.
 java.io.OutputStream getOutputStream()
          If this DirectoryEntry is writable, then return an OutputStream instance to the resource represented by this entry.
 boolean loadPreview()
          Load property values associated with this DirectoryEntry and return whether the preview properties are now available.
 java.net.URL toURL()
          Converts this abstract pathname into a URL.
 
Methods inherited from interface com.metamatrix.common.tree.TreeNode
compareTo, equals, exists, getFullName, getName, getNamespace, getSeparator, getSeparatorChar, getType, isModified, toString
 

Field Detail

TYPE_FILE

static final FileDefinition TYPE_FILE

TYPE_FOLDER

static final FolderDefinition TYPE_FOLDER
Method Detail

canWrite

boolean canWrite()
Return whether it is possible to write to this DirectoryEntry, and whether an output stream can be obtained for this entry. This method may return true even if this entry does not exist (i.e., exists() returns true).

Returns:
true if writing is possible, as well as whether an OutputStream instance can be obtained by calling the getOutputStream() method.

canRead

boolean canRead()
Return whether it is possible to read from this DirectoryEntry, and whether an input stream can be obtained for this entry. This method always returns false if this entry does not exist (i.e., exists() returns false).

Returns:
true if reading is possible, as well as whether an InputStream instance can be obtained by calling the getInputStream() method.

loadPreview

boolean loadPreview()
Load property values associated with this DirectoryEntry and return whether the preview properties are now available.

Returns:
if the properties have been loaded.

getInputStream

java.io.InputStream getInputStream()
                                   throws java.io.IOException
If this DirectoryEntry is readable, then return an InputStream instance to the resource represented by this entry.

Returns:
the InputStream for this entry.
Throws:
java.lang.AssertionError - if this method is called on a DirectoryEntry for which canRead() returns false.
java.io.IOException - if there was an error creating the stream

getOutputStream

java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
If this DirectoryEntry is writable, then return an OutputStream instance to the resource represented by this entry.

Returns:
the OutputStream for this entry.
Throws:
java.lang.AssertionError - if this method is called on a DirectoryEntry for which canWrite() returns false.
java.io.IOException - if there was an error creating the stream

toURL

java.net.URL toURL()
                   throws java.net.MalformedURLException
Converts this abstract pathname into a URL. The exact form of the URL is dependent upon the implementation. If it can be determined that the file denoted by this abstract pathname is a directory, then the resulting URL will end with a slash.

Returns:
the URL for this DirectoryEntry.
Throws:
java.net.MalformedURLException - if the URL is malformed.


Copyright © 2009. All Rights Reserved.