Skip navigation links

Oracle® Coherence Java API Reference
v3.5.1

E15583-01


com.tangosol.io
Class WriterPrintStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.PrintStream
              extended by com.tangosol.io.WriterPrintStream

All Implemented Interfaces:
OutputStreaming, java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class WriterPrintStream
extends java.io.PrintStream
implements OutputStreaming

Overrides PrintStream to delegate to a PrintWriter.

Author:
cp 2000.11.01

Field Summary

 

Fields inherited from class java.io.FilterOutputStream
out

 

Constructor Summary
WriterPrintStream(java.io.PrintWriter out)
           

 

Method Summary
 boolean checkError()
          Flush the stream and check its error state.
 void close()
          Close the stream.
 void flush()
          Flush the stream.
 void print(boolean f)
          Print a boolean value.
 void print(char ch)
          Print a character.
 void print(char[] ach)
          Print an array of characters.
 void print(double dfl)
          Print a double-precision floating-point number.
 void print(float fl)
          Print a floating-point number.
 void print(int i)
          Print an integer.
 void print(long l)
          Print a long integer.
 void print(java.lang.Object o)
          Print an object.
 void print(java.lang.String s)
          Print a string.
 void println()
          Terminate the current line by writing the line separator string.
 void println(boolean f)
          Print a boolean and then terminate the line.
 void println(char ch)
          Print a character and then terminate the line.
 void println(char[] ach)
          Print an array of characters and then terminate the line.
 void println(double dfl)
          Print a double and then terminate the line.
 void println(float fl)
          Print a float and then terminate the line.
 void println(int i)
          Print an integer and then terminate the line.
 void println(long l)
          Print a long and then terminate the line.
 void println(java.lang.Object o)
          Print an Object and then terminate the line.
 void println(java.lang.String s)
          Print a String and then terminate the line.
protected  void setError()
          Set the error state of the stream to true.
 void write(byte[] ab, int of, int cb)
          Write len bytes from the specified byte array starting at offset off to this stream.
 void write(int b)
          Write the specified byte to this stream.

 

Methods inherited from class java.io.PrintStream
append, append, append, append, append, append, format, format, printf, printf

 

Methods inherited from class java.io.FilterOutputStream
write

 

Methods inherited from interface com.tangosol.io.OutputStreaming
write

 

Constructor Detail

WriterPrintStream

public WriterPrintStream(java.io.PrintWriter out)

Method Detail

flush

public void flush()
Flush the stream. This is done by writing any buffered output bytes to the underlying output stream and then flushing that stream.
Specified by:
flush in interface OutputStreaming
Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.PrintStream
See Also:
OutputStream.flush()

close

public void close()
Close the stream. This is done by flushing the stream and then closing the underlying output stream.
Specified by:
close in interface OutputStreaming
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.PrintStream
See Also:
OutputStream.close()

checkError

public boolean checkError()
Flush the stream and check its error state. The internal error state is set to true when the underlying output stream throws an IOException other than InterruptedIOException, and when the setError method is invoked. If an operation on the underlying output stream throws an InterruptedIOException, then the PrintStream converts the exception back into an interrupt by doing:
     Thread.currentThread().interrupt();
 
or the equivalent.
Overrides:
checkError in class java.io.PrintStream
Returns:
True if and only if this stream has encountered an IOException other than InterruptedIOException, or the setError method has been invoked

setError

protected void setError()
Set the error state of the stream to true.
Overrides:
setError in class java.io.PrintStream
Since:
JDK1.1

write

public void write(int b)
Write the specified byte to this stream. If the byte is a newline and automatic flushing is enabled then the flush method will be invoked.

Note that the byte is written as given; to write a character that will be translated according to the platform's default character encoding, use the print(char) or println(char) methods.

Specified by:
write in interface OutputStreaming
Overrides:
write in class java.io.PrintStream
Parameters:
b - The byte to be written
See Also:
print(char), println(char)

write

public void write(byte[] ab,
                  int of,
                  int cb)
Write len bytes from the specified byte array starting at offset off to this stream. If automatic flushing is enabled then the flush method will be invoked.

Note that the bytes will be written as given; to write characters that will be translated according to the platform's default character encoding, use the print(char) or println(char) methods.

Specified by:
write in interface OutputStreaming
Overrides:
write in class java.io.PrintStream
Parameters:
ab - A byte array
of - Offset from which to start taking bytes
cb - Number of bytes to write

print

public void print(boolean f)
Print a boolean value. The string produced by String.valueOf(boolean) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
Overrides:
print in class java.io.PrintStream
Parameters:
f - The boolean to be printed

print

public void print(char ch)
Print a character. The character is translated into one or more bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
Overrides:
print in class java.io.PrintStream
Parameters:
ch - The char to be printed

print

public void print(int i)
Print an integer. The string produced by String.valueOf(int) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
Overrides:
print in class java.io.PrintStream
Parameters:
i - The int to be printed
See Also:
Integer.toString(int)

print

public void print(long l)
Print a long integer. The string produced by String.valueOf(long) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
Overrides:
print in class java.io.PrintStream
Parameters:
l - The long to be printed
See Also:
Long.toString(long)

print

public void print(float fl)
Print a floating-point number. The string produced by String.valueOf(float) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
Overrides:
print in class java.io.PrintStream
Parameters:
fl - The float to be printed
See Also:
Float.toString(float)

print

public void print(double dfl)
Print a double-precision floating-point number. The string produced by String.valueOf(double) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
Overrides:
print in class java.io.PrintStream
Parameters:
dfl - The double to be printed
See Also:
Double.toString(double)

print

public void print(char[] ach)
Print an array of characters. The characters are converted into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
Overrides:
print in class java.io.PrintStream
Parameters:
ach - The array of chars to be printed
Throws:
java.lang.NullPointerException - If s is null

print

public void print(java.lang.String s)
Print a string. If the argument is null then the string "null" is printed. Otherwise, the string's characters are converted into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
Overrides:
print in class java.io.PrintStream
Parameters:
s - The String to be printed

print

public void print(java.lang.Object o)
Print an object. The string produced by the String.valueOf(Object) method is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
Overrides:
print in class java.io.PrintStream
Parameters:
o - The Object to be printed
See Also:
Object.toString()

println

public void println()
Terminate the current line by writing the line separator string. The line separator string is defined by the system property line.separator, and is not necessarily a single newline character ('\n').
Overrides:
println in class java.io.PrintStream

println

public void println(boolean f)
Print a boolean and then terminate the line. This method behaves as though it invokes print(boolean) and then println().
Overrides:
println in class java.io.PrintStream
Parameters:
f - The boolean to be printed

println

public void println(char ch)
Print a character and then terminate the line. This method behaves as though it invokes print(char) and then println().
Overrides:
println in class java.io.PrintStream
Parameters:
ch - The char to be printed.

println

public void println(int i)
Print an integer and then terminate the line. This method behaves as though it invokes print(int) and then println().
Overrides:
println in class java.io.PrintStream
Parameters:
i - The int to be printed.

println

public void println(long l)
Print a long and then terminate the line. This method behaves as though it invokes print(long) and then println().
Overrides:
println in class java.io.PrintStream
Parameters:
l - a The long to be printed.

println

public void println(float fl)
Print a float and then terminate the line. This method behaves as though it invokes print(float) and then println().
Overrides:
println in class java.io.PrintStream
Parameters:
fl - The float to be printed.

println

public void println(double dfl)
Print a double and then terminate the line. This method behaves as though it invokes print(double) and then println().
Overrides:
println in class java.io.PrintStream
Parameters:
dfl - The double to be printed.

println

public void println(char[] ach)
Print an array of characters and then terminate the line. This method behaves as though it invokes print(char[]) and then println().
Overrides:
println in class java.io.PrintStream
Parameters:
ach - an array of chars to print.

println

public void println(java.lang.String s)
Print a String and then terminate the line. This method behaves as though it invokes print(String) and then println().
Overrides:
println in class java.io.PrintStream
Parameters:
s - The String to be printed.

println

public void println(java.lang.Object o)
Print an Object and then terminate the line. This method behaves as though it invokes print(Object) and then println().
Overrides:
println in class java.io.PrintStream
Parameters:
o - The Object to be printed.

Skip navigation links

Oracle® Coherence Java API Reference
v3.5.1

E15583-01


Copyright © 2000, 2009, Oracle. All rights reserved.