openjava.tools
Class WriterStack

java.lang.Object
  |
  +--openjava.tools.WriterStack

public class WriterStack
extends Object

Wrapper class of class Stack to specialize into Writer.


Field Summary
private static PrintWriter defaultWriter
           
private  Stack stack
           
 
Constructor Summary
WriterStack()
          Constructs this stack with an element(standard output).
WriterStack(OutputStream out)
          Constructs this stack with the specified output stream.
WriterStack(PrintWriter writer)
          Constructs this stack with the specified print writer.
WriterStack(Writer writer)
          Constructs this stack with the specified writer.
 
Method Summary
 boolean empty()
          Tests if this stack is empty.
 PrintWriter peek()
          Looks at the print writer at the top of this stack without removing it from the stack.
 PrintWriter pop()
          Removes the print writer at the top of this stack and returns that print writer as the value of this function.
 void push(OutputStream ostream)
          Pushes a print writer from the specified print stream onto the top of this stack.
 void push(PrintWriter writer)
          Pushes a print writer onto the top of this stack.
 void push(Writer writer)
          Pushes a print writer onto the top of this stack.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stack

private Stack stack

defaultWriter

private static PrintWriter defaultWriter
Constructor Detail

WriterStack

public WriterStack()
Constructs this stack with an element(standard output).


WriterStack

public WriterStack(PrintWriter writer)
Constructs this stack with the specified print writer.


WriterStack

public WriterStack(Writer writer)
Constructs this stack with the specified writer.


WriterStack

public WriterStack(OutputStream out)
Constructs this stack with the specified output stream.

Method Detail

peek

public PrintWriter peek()
Looks at the print writer at the top of this stack without removing it from the stack.

Returns:
the print writer at the top of this stack.

pop

public PrintWriter pop()
Removes the print writer at the top of this stack and returns that print writer as the value of this function.

Returns:
The object at the top of this stack.

push

public void push(PrintWriter writer)
Pushes a print writer onto the top of this stack.

Parameters:
writer - the print writer to be pushed onto this stack.
Returns:
the item argument.

push

public void push(Writer writer)
Pushes a print writer onto the top of this stack.

Parameters:
writer - the writer to be pushed onto this stack.
Returns:
the item argument.

push

public void push(OutputStream ostream)
Pushes a print writer from the specified print stream onto the top of this stack.

Parameters:
ostream - the output stream to be pushed onto this stack.
Returns:
the item argument.

empty

public boolean empty()
Tests if this stack is empty.

Returns:
true if this stack is empty; false otherwise.

SourceForge.net_Logo