ewe.io
Class PrintWriter

java.lang.Object
  extended byewe.io.Writer
      extended byewe.io.PrintWriter

public class PrintWriter
extends Writer

This class provides the same API as java.io.PrintWriter. None of its methods throws an Exception. You can check the error status of the Writer by calling the checkError() method.


Field Summary
 String lineSeparator
          Use this to provide your own line separator String.
protected  Writer writer
          The underlying writer.
 
Fields inherited from class ewe.io.Writer
lock
 
Constructor Summary
PrintWriter(BasicStream out)
          Create a new TextWriter to write to the specified Stream.
PrintWriter(BasicStream out, boolean autoFlush)
          Create a new TextWriter to write to the specified Stream.
PrintWriter(OutputStream out)
          Create a new TextWriter to write to the specified Stream.
PrintWriter(OutputStream out, boolean autoFlush)
          Create a new TextWriter to write to the specified Stream.
PrintWriter(Writer writer)
           
PrintWriter(Writer writer, boolean autoFlush)
           
 
Method Summary
 boolean checkError()
          Flush the stream and check its error state.
 void close()
          Close the stream, flushing it first.
 void flush()
          Flush the stream.
 void print(boolean value)
           
 void print(char value)
           
 void print(char[] chars)
           
 void print(double value)
           
 void print(float value)
           
 void print(int value)
           
 void print(long value)
           
 void print(Object value)
           
 void print(String str)
           
 void println()
          Output a line-feed (end of line) character.
 void println(boolean value)
           
 void println(char value)
           
 void println(char[] chars)
           
 void println(double value)
           
 void println(float value)
           
 void println(int value)
           
 void println(long value)
           
 void println(Object value)
           
 void println(String str)
           
protected  void setError()
           
 void write(char[] chars)
          Write out a number of characters.
 void write(char[] chars, int offset, int length)
          Write out a number of characters.
 void write(int aChar)
          Write a single character.
 void write(String str)
          Write a string.
 void write(String str, int offset, int length)
          Write a portion of a string.
 
Methods inherited from class ewe.io.Writer
getLock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, toString
 

Field Detail

writer

protected Writer writer
The underlying writer.


lineSeparator

public String lineSeparator
Use this to provide your own line separator String. By default it is null which will translate to the underlying OS's line separator. You can set it to be any other string.

Constructor Detail

PrintWriter

public PrintWriter(BasicStream out)
Create a new TextWriter to write to the specified Stream.

Parameters:
out - The output Stream.

PrintWriter

public PrintWriter(BasicStream out,
                   boolean autoFlush)
Create a new TextWriter to write to the specified Stream.

Parameters:
out - The output Stream.
autoFlush - if this is true a println() method will flush the output stream.

PrintWriter

public PrintWriter(OutputStream out,
                   boolean autoFlush)
Create a new TextWriter to write to the specified Stream.

Parameters:
out - The OutputStream.
autoFlush - if this is true a println() method will flush the output stream.

PrintWriter

public PrintWriter(OutputStream out)
Create a new TextWriter to write to the specified Stream.

Parameters:
out - The OutputStream.

PrintWriter

public PrintWriter(Writer writer)

PrintWriter

public PrintWriter(Writer writer,
                   boolean autoFlush)
Method Detail

write

public void write(char[] chars,
                  int offset,
                  int length)
Write out a number of characters.

Specified by:
write in class Writer
Parameters:
chars - The characters to be writen.
offset - The location in the chars to start writing from.
length - The number of characters to write.

write

public void write(char[] chars)
Write out a number of characters.

Overrides:
write in class Writer
Parameters:
chars - The characters to be writen.

write

public void write(String str)
Description copied from class: Writer
Write a string.

Overrides:
write in class Writer
Parameters:
str - String to be written

write

public void write(int aChar)
Description copied from class: Writer
Write a single character. The character to be written is contained in the 16 low-order bits of the given integer value; the 16 high-order bits are ignored.

Overrides:
write in class Writer

write

public void write(String str,
                  int offset,
                  int length)
Description copied from class: Writer
Write a portion of a string.

Overrides:
write in class Writer
Parameters:
str - A String
offset - Offset from which to start writing characters
length - Number of characters to write

flush

public void flush()
Description copied from class: Writer
Flush the stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams.

Specified by:
flush in class Writer

close

public void close()
Description copied from class: Writer
Close the stream, flushing it first. Once a stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously-closed stream, however, has no effect.

Specified by:
close in class Writer

println

public void println()
Output a line-feed (end of line) character.


setError

protected void setError()

checkError

public boolean checkError()
Flush the stream and check its error state.

Returns:
true if the stream encountered an error in writing or encoding. False otherwise.

print

public void print(char[] chars)

print

public void print(String str)

print

public void print(int value)

print

public void print(boolean value)

print

public void print(char value)

print

public void print(float value)

print

public void print(double value)

print

public void print(long value)

print

public void print(Object value)

println

public void println(char[] chars)

println

public void println(String str)

println

public void println(int value)

println

public void println(boolean value)

println

public void println(char value)

println

public void println(float value)

println

public void println(double value)

println

public void println(long value)

println

public void println(Object value)