|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.omegahat.Environment.IO.BasicObjectDisplay
This class takes care of displaying different objects on
a output stream in simple ascii text with no markup.
This is suitable for output to the console.
It knows about certain types (such
as array, Vector, etc.) and delegates some control to
the individual objects that implement SelfDisplaying.
This can be extended to add markup for different output devices
such as TeX and HTML.
| Field Summary | |
static java.lang.String |
OutputElementSeparator
The separator between the display of the different sub-elements of a container objects (e.g. |
protected java.io.PrintWriter |
stdout
|
| Constructor Summary | |
BasicObjectDisplay()
Default constructor that uses the standard output device from System.out
as the output stream. |
|
BasicObjectDisplay(java.io.PrintWriter out)
Constructor with the output stream specified. |
|
| Method Summary | |
boolean |
defaultDisplay(java.lang.Object obj)
Default display method which simply prints the object to the output stream (without a newline). |
boolean |
defaultDisplay(java.lang.Object obj,
long level)
Default display that preserves the level of nesting of the output. |
boolean |
display(java.util.Enumeration e)
Display the contents of an Enumeration
just as we show the contents of an array
displayArray(Object),
separating each element with the
OutputElementSeparator. |
boolean |
display(java.lang.Object obj)
Display the given object considering it as the top-level object being displayed. |
boolean |
display(java.lang.Object obj,
long level)
Display the given object assuming it is nested level objects within
the top-level object being displayed
by display(Object). |
boolean |
displayArray(java.lang.Object obj)
Display an array object, writing each element to the output stream, separating each from the previous value by the separator OutputElementSeparator. |
java.io.PrintWriter |
stdout()
Retrieve the current output stream on which the objects are being displayed. |
java.io.PrintWriter |
stdout(java.io.PrintWriter w)
Specify the output stream to which the object representations should be written. |
java.lang.String |
toString(java.lang.Object obj)
Get the string representation of the given object as this filter would mark it up. |
java.io.Writer |
toWriter(java.lang.Object obj)
Display the given object on the filter's output stream using the representation of the object from toString(Object) |
java.io.Writer |
writer()
Retrieve the (default) output stream to which the display is writing. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static java.lang.String OutputElementSeparator
Vector, etc.)
This can be easily modified to change the containers
to be displayed on the same line separated by e.g. ", "
rather than a new-line.
This is shared by all instances of this class.
This may need to be make instance-specific.
It is public to allow easy access to modifying it interactively.protected java.io.PrintWriter stdout
| Constructor Detail |
public BasicObjectDisplay()
System.out
as the output stream.public BasicObjectDisplay(java.io.PrintWriter out)
out - the output stream on which the contents
of objects should be displayed.| Method Detail |
public java.lang.String toString(java.lang.Object obj)
toString in interface ObjectDisplayFilterpublic java.io.Writer toWriter(java.lang.Object obj)
toString(Object)toWriter in interface ObjectDisplayFilterpublic java.io.Writer writer()
writer in interface ObjectDisplayFilterpublic boolean display(java.lang.Object obj)
display in interface ObjectDisplayFilterorg.omegahat.Environment.IO.ObjectDisplayFilterObjectDisplayFilter.display(java.lang.Object, long)
public boolean display(java.lang.Object obj,
long level)
level objects within
the top-level object being displayed
by display(Object).display in interface ObjectDisplayFilterpublic boolean displayArray(java.lang.Object obj)
OutputElementSeparator.public boolean display(java.util.Enumeration e)
Enumeration
just as we show the contents of an array
displayArray(Object),
separating each element with the
OutputElementSeparator.
separator.public boolean defaultDisplay(java.lang.Object obj)
public boolean defaultDisplay(java.lang.Object obj,
long level)
public java.io.PrintWriter stdout()
public java.io.PrintWriter stdout(java.io.PrintWriter w)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||