Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

konspire.common
Class StringPrintWriter  view StringPrintWriter download StringPrintWriter.java

java.lang.Object
  extended byjava.io.Writer
      extended byjava.io.PrintWriter
          extended bykonspire.common.StringPrintWriter

public class StringPrintWriter
extends java.io.PrintWriter

A PrintWriter that prints to a String. Automatic line flushing is enabled by default.

Note that the implementation is very ugly right now in attempt to support Java1.1. In 1.1, the Writer is not accessible to subclasses because it is private. Thus, we can't replace the writer after calling the superclass constructor, nor can we simply call the superclass constructor and pass in our own member writer (because we can't access member variables before calling the superclass constructor). So, this implementation keeps a member PrintWriter and has wrapper functions for every PrintWriter function.

This putrid implementation will change once we're doing full-blown 1.2, because 1.2 makes the underlying Writer accessible to subclasses.


Field Summary
private  java.io.PrintWriter mPrintWriter
           
private  java.io.StringWriter mStringWriter
           
 
Fields inherited from class java.io.PrintWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
StringPrintWriter()
          Constructs a StringPrintWriter.
 
Method Summary
 boolean checkError()
          This method checks to see if an error has occurred on this stream.
 void close()
          This method closes this stream and all underlying streams.
 void flush()
          This method flushes any buffered chars to the underlying stream and then flushes that stream as well.
 void print(boolean inValue)
          This methods prints a boolean value to the stream.
 void print(char inValue)
          This method prints a char to the stream.
 void print(char[] inValue)
          This method prints an array of characters to the stream.
 void print(double inValue)
          This method prints a double to the stream.
 void print(float inValue)
          This method prints a float to the stream.
 void print(int inValue)
          This method prints an integer to the stream.
 void print(long inValue)
          This method prints a long to the stream.
 void print(java.lang.Object inValue)
          This method prints an Object to the stream.
 void print(java.lang.String inValue)
          This method prints a String to the stream.
 void println()
          This method prints a line separator sequence to the stream.
 void println(boolean inValue)
          This methods prints a boolean value to the stream.
 void println(char inValue)
          This method prints a char to the stream.
 void println(char[] inValue)
          This method prints an array of characters to the stream.
 void println(double inValue)
          This method prints a double to the stream.
 void println(float inValue)
          This method prints a float to the stream.
 void println(int inValue)
          This method prints an integer to the stream.
 void println(long inValue)
          This method prints a long to the stream.
 void println(java.lang.Object inValue)
          This method prints an Object to the stream.
 void println(java.lang.String inValue)
          This method prints a String to the stream.
 java.lang.String toString()
          Gets the buffer's current contents as a String.
 void write(char[] inValue)
          This method write all the chars in the specified array to the output.
 void write(char[] inValue, int inStart, int inEnd)
          This method writes count chars from the specified array starting at index offset into the array.
 void write(int inValue)
          This method writes a single char to the stream.
 void write(java.lang.String inValue)
          This method writes the contents of the specified String to the underlying stream.
 void write(java.lang.String inValue, int inStart, int inEnd)
          This method writes count chars from the specified String to the output starting at character position offset into the String
 
Methods inherited from class java.io.PrintWriter
setError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mStringWriter

private java.io.StringWriter mStringWriter

mPrintWriter

private java.io.PrintWriter mPrintWriter
Constructor Detail

StringPrintWriter

public StringPrintWriter()
Constructs a StringPrintWriter.

Method Detail

toString

public java.lang.String toString()
Gets the buffer's current contents as a String.


checkError

public boolean checkError()
Description copied from class: java.io.PrintWriter
This method checks to see if an error has occurred on this stream. Note that once an error has occurred, this method will continue to report true forever for this stream. Before checking for an error condition, this method flushes the stream.


close

public void close()
Description copied from class: java.io.PrintWriter
This method closes this stream and all underlying streams.


flush

public void flush()
Description copied from class: java.io.PrintWriter
This method flushes any buffered chars to the underlying stream and then flushes that stream as well.


print

public void print(boolean inValue)
Description copied from class: java.io.PrintWriter
This methods prints a boolean value to the stream. true values are printed as "true" and false values are printed as "false".


print

public void print(char inValue)
Description copied from class: java.io.PrintWriter
This method prints a char to the stream. The actual value printed is determined by the character encoding in use.


print

public void print(char[] inValue)
Description copied from class: java.io.PrintWriter
This method prints an array of characters to the stream. The actual value printed depends on the system default encoding.


print

public void print(double inValue)
Description copied from class: java.io.PrintWriter
This method prints a double to the stream. The value printed is determined using the String.valueOf() method.


print

public void print(float inValue)
Description copied from class: java.io.PrintWriter
This method prints a float to the stream. The value printed is determined using the String.valueOf() method.


print

public void print(int inValue)
Description copied from class: java.io.PrintWriter
This method prints an integer to the stream. The value printed is determined using the String.valueOf() method.


print

public void print(long inValue)
Description copied from class: java.io.PrintWriter
This method prints a long to the stream. The value printed is determined using the String.valueOf() method.


print

public void print(java.lang.Object inValue)
Description copied from class: java.io.PrintWriter
This method prints an Object to the stream. The actual value printed is determined by calling the String.valueOf() method.


print

public void print(java.lang.String inValue)
Description copied from class: java.io.PrintWriter
This method prints a String to the stream. The actual value printed depends on the system default encoding.


println

public void println()
Description copied from class: java.io.PrintWriter
This method prints a line separator sequence to the stream. The value printed is determined by the system property line.separator and is not necessarily the Unix '\n' newline character.


println

public void println(boolean inValue)
Description copied from class: java.io.PrintWriter
This methods prints a boolean value to the stream. true values are printed as "true" and false values are printed as "false". This method prints a line termination sequence after printing the value.


println

public void println(char inValue)
Description copied from class: java.io.PrintWriter
This method prints a char to the stream. The actual value printed is determined by the character encoding in use. This method prints a line termination sequence after printing the value.


println

public void println(char[] inValue)
Description copied from class: java.io.PrintWriter
This method prints an array of characters to the stream. The actual value printed depends on the system default encoding. This method prints a line termination sequence after printing the value.


println

public void println(double inValue)
Description copied from class: java.io.PrintWriter
This method prints a double to the stream. The value printed is determined using the String.valueOf() method. This method prints a line termination sequence after printing the value.


println

public void println(float inValue)
Description copied from class: java.io.PrintWriter
This method prints a float to the stream. The value printed is determined using the String.valueOf() method. This method prints a line termination sequence after printing the value.


println

public void println(int inValue)
Description copied from class: java.io.PrintWriter
This method prints an integer to the stream. The value printed is determined using the String.valueOf() method. This method prints a line termination sequence after printing the value.


println

public void println(long inValue)
Description copied from class: java.io.PrintWriter
This method prints a long to the stream. The value printed is determined using the String.valueOf() method. This method prints a line termination sequence after printing the value.


println

public void println(java.lang.Object inValue)
Description copied from class: java.io.PrintWriter
This method prints an Object to the stream. The actual value printed is determined by calling the String.valueOf() method. This method prints a line termination sequence after printing the value.


println

public void println(java.lang.String inValue)
Description copied from class: java.io.PrintWriter
This method prints a String to the stream. The actual value printed depends on the system default encoding. This method prints a line termination sequence after printing the value.


write

public void write(char[] inValue)
Description copied from class: java.io.PrintWriter
This method write all the chars in the specified array to the output.


write

public void write(char[] inValue,
                  int inStart,
                  int inEnd)
Description copied from class: java.io.PrintWriter
This method writes count chars from the specified array starting at index offset into the array.


write

public void write(int inValue)
Description copied from class: java.io.PrintWriter
This method writes a single char to the stream.


write

public void write(java.lang.String inValue)
Description copied from class: java.io.PrintWriter
This method writes the contents of the specified String to the underlying stream.


write

public void write(java.lang.String inValue,
                  int inStart,
                  int inEnd)
Description copied from class: java.io.PrintWriter
This method writes count chars from the specified String to the output starting at character position offset into the String