|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.metamatrix.common.tree.directory.PreviewableDirectoryEntry
public class PreviewableDirectoryEntry
This class represents a wrapper for a DirectoryEntry that
holds off on actually writing to the DirectoryEntry so
that a preview of the result can be obtained prior to writing.
Once the preview is determined to be acceptable, the
getPreviewStream()
method can be used to actually write the previewable contents
to the DirectoryEntry.
An instance of this class can only be used to wrap a
DirectoryEntry that can write (i.e.,
DirectoryEntry.canWrite()
returns true).
| Field Summary | |
|---|---|
protected static int |
BUFFER_SIZE
|
| Fields inherited from interface com.metamatrix.common.tree.directory.DirectoryEntry |
|---|
TYPE_FILE, TYPE_FOLDER |
| Constructor Summary | |
|---|---|
PreviewableDirectoryEntry(DirectoryEntry actualEntry)
Construct a new instance that wraps another DirectoryEntry |
|
| Method Summary | |
|---|---|
boolean |
canRead()
Returns true if there was anything written to the buffer. |
boolean |
canWrite()
Return whether it is possible to write to this DirectoryEntry, and whether an output stream can be obtained for this entry. |
void |
clearPreview()
|
int |
compareTo(java.lang.Object o)
Compares this object to another. |
boolean |
equals(java.lang.Object o)
Returns true if the specified object is semantically equal to this instance. |
boolean |
exists()
Return whether this TreeNode represents an existing resource. |
java.lang.String |
getFullName()
Obtain the full name of the TreeNode which is unique within the TreeView. |
java.io.InputStream |
getInputStream()
If this DirectoryEntry is readable, then return an InputStream instance to the resource represented by this entry. |
java.lang.String |
getName()
Obtain the name of this TreeNode. |
java.lang.String |
getNamespace()
Obtain the namespace to which this tree node belongs. |
java.io.OutputStream |
getOutputStream()
If this DirectoryEntry is writable, then return an OutputStream instance to the resource represented by this entry. |
java.lang.String |
getSeparator()
Obtain the character (as a String) that is used to separate names in a path sequence for the abstract path. |
char |
getSeparatorChar()
Obtain the character that is used to separate names in a path sequence for the abstract path. |
DirectoryEntry |
getTargetDirectoryEntry()
|
ObjectDefinition |
getType()
Get this type for this tree node. |
boolean |
hasPreview()
|
boolean |
isModified()
Return whether this node has undergone changes. |
boolean |
loadPreview()
Load property values associated with this DirectoryEntry and return whether the preview properties are now available. |
boolean |
savePreview()
Writes the preview to the entry. |
java.net.URL |
toURL()
Converts this abstract pathname into a URL. |
boolean |
writePreview(java.io.Writer writer,
boolean closeWriterUponCompletion)
Writes the preview to the specified writer. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.metamatrix.common.tree.TreeNode |
|---|
toString |
| Field Detail |
|---|
protected static final int BUFFER_SIZE
| Constructor Detail |
|---|
public PreviewableDirectoryEntry(DirectoryEntry actualEntry)
actualEntry - the DirectoryEntry that this instance is a preview for;
may not be null| Method Detail |
|---|
public java.io.OutputStream getOutputStream()
throws java.io.IOException
DirectoryEntry
getOutputStream in interface DirectoryEntryjava.io.IOException - if there was an error creating the stream
public boolean savePreview()
throws java.io.IOException
java.io.IOException - if there is an error writing
the contents to the DirectoryEntry
public boolean writePreview(java.io.Writer writer,
boolean closeWriterUponCompletion)
throws java.io.IOException
writer - the Writer to which the preview contents should be writtencloseWriterUponCompletion - true if this method should attempt to
close writer when this method completes writing the contents
java.io.IOException - if there is an error reading the contents or writing
the contents to writer
public void clearPreview()
throws java.io.IOException
java.io.IOExceptionpublic boolean hasPreview()
public DirectoryEntry getTargetDirectoryEntry()
public boolean canRead()
canRead in interface DirectoryEntrygetInputStream() method.DirectoryEntry.canRead()
public java.io.InputStream getInputStream()
throws java.io.IOException
DirectoryEntry
getInputStream in interface DirectoryEntryjava.io.IOException - if there was an error creating the streampublic boolean canWrite()
DirectoryEntryexists()
returns true).
- Specified by:
canWrite in interface DirectoryEntry
- Returns:
- true if writing is possible, as well as whether an OutputStream instance
can be obtained by calling the
getOutputStream() method.
public boolean loadPreview()
DirectoryEntry
loadPreview in interface DirectoryEntry
public java.net.URL toURL()
throws java.net.MalformedURLException
DirectoryEntry
toURL in interface DirectoryEntryjava.net.MalformedURLException - if the URL is malformed.public boolean exists()
TreeNode
exists in interface TreeNodepublic java.lang.String getName()
TreeNode
getName in interface TreeNodepublic java.lang.String getFullName()
TreeNode
getFullName in interface TreeNodepublic java.lang.String getNamespace()
TreeNode
getNamespace in interface TreeNodepublic ObjectDefinition getType()
TreeNode
getType in interface TreeNodepublic char getSeparatorChar()
TreeNode
getSeparatorChar in interface TreeNodepublic java.lang.String getSeparator()
TreeNode
getSeparator in interface TreeNodepublic boolean isModified()
TreeNode
isModified in interface TreeNodepublic int compareTo(java.lang.Object o)
TreeNode
Note: this method is consistent with
equals(), meaning that
(compare(x, y)==0) == (x.equals(y)).
compareTo in interface TreeNodecompareTo in interface java.lang.Comparablepublic boolean equals(java.lang.Object o)
TreeNodecompareTo().
equals in interface TreeNodeequals in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||