Package com.tangosol.io
Class WriterPrintStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.PrintStream
com.tangosol.io.WriterPrintStream
- All Implemented Interfaces:
com.oracle.coherence.common.io.OutputStreaming
,OutputStreaming
,Closeable
,Flushable
,Appendable
,AutoCloseable
Overrides PrintStream to delegate to a PrintWriter.
- Author:
- cp 2000.11.01
-
Field Summary
Fields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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 an object.void
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
Print an Object and then terminate the line.void
Print a String and then terminate the line.protected void
setError()
Set the error state of the stream totrue
.void
write
(byte[] ab, int of, int cb) Writelen
bytes from the specified byte array starting at offsetoff
to this stream.void
write
(int b) Write the specified byte to this stream.Methods inherited from class java.io.PrintStream
append, append, append, charset, clearError, format, format, printf, printf, write, writeBytes
Methods inherited from class java.io.OutputStream
nullOutputStream
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.oracle.coherence.common.io.OutputStreaming
write
-
Constructor Details
-
WriterPrintStream
-
-
Method Details
-
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 interfaceFlushable
- Specified by:
flush
in interfacecom.oracle.coherence.common.io.OutputStreaming
- Overrides:
flush
in classPrintStream
- See Also:
-
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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfacecom.oracle.coherence.common.io.OutputStreaming
- Overrides:
close
in classPrintStream
- See Also:
-
checkError
public boolean checkError()Flush the stream and check its error state. The internal error state is set totrue
when the underlying output stream throws anIOException
other thanInterruptedIOException
, and when thesetError
method is invoked. If an operation on the underlying output stream throws anInterruptedIOException
, then thePrintStream
converts the exception back into an interrupt by doing:Thread.currentThread().interrupt();
or the equivalent.- Overrides:
checkError
in classPrintStream
- Returns:
- True if and only if this stream has encountered an
IOException
other thanInterruptedIOException
, or thesetError
method has been invoked
-
setError
protected void setError()Set the error state of the stream totrue
.- Overrides:
setError
in classPrintStream
- 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 theflush
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)
orprintln(char)
methods.- Specified by:
write
in interfacecom.oracle.coherence.common.io.OutputStreaming
- Overrides:
write
in classPrintStream
- Parameters:
b
- The byte to be written- See Also:
-
write
public void write(byte[] ab, int of, int cb) Writelen
bytes from the specified byte array starting at offsetoff
to this stream. If automatic flushing is enabled then theflush
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)
orprintln(char)
methods.- Specified by:
write
in interfacecom.oracle.coherence.common.io.OutputStreaming
- Overrides:
write
in classPrintStream
- Parameters:
ab
- A byte arrayof
- Offset from which to start taking bytescb
- Number of bytes to write
-
print
public void print(boolean f) Print a boolean value. The string produced by
is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of theString.valueOf(boolean)
method.write(int)
- Overrides:
print
in classPrintStream
- Parameters:
f
- Theboolean
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
method.write(int)
- Overrides:
print
in classPrintStream
- Parameters:
ch
- Thechar
to be printed
-
print
public void print(int i) Print an integer. The string produced by
is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of theString.valueOf(int)
method.write(int)
- Overrides:
print
in classPrintStream
- Parameters:
i
- Theint
to be printed- See Also:
-
print
public void print(long l) Print a long integer. The string produced by
is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of theString.valueOf(long)
method.write(int)
- Overrides:
print
in classPrintStream
- Parameters:
l
- Thelong
to be printed- See Also:
-
print
public void print(float fl) Print a floating-point number. The string produced by
is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of theString.valueOf(float)
method.write(int)
- Overrides:
print
in classPrintStream
- Parameters:
fl
- Thefloat
to be printed- See Also:
-
print
public void print(double dfl) Print a double-precision floating-point number. The string produced by
is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of theString.valueOf(double)
method.write(int)
- Overrides:
print
in classPrintStream
- Parameters:
dfl
- Thedouble
to be printed- See Also:
-
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
method.write(int)
- Overrides:
print
in classPrintStream
- Parameters:
ach
- The array of chars to be printed- Throws:
NullPointerException
- Ifs
isnull
-
print
Print a string. If the argument isnull
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
method.write(int)
- Overrides:
print
in classPrintStream
- Parameters:
s
- TheString
to be printed
-
print
Print an object. The string produced by the
method is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of theString.valueOf(Object)
method.write(int)
- Overrides:
print
in classPrintStream
- Parameters:
o
- TheObject
to be printed- See Also:
-
println
public void println()Terminate the current line by writing the line separator string. The line separator string is defined by the system propertyline.separator
, and is not necessarily a single newline character ('\n'
).- Overrides:
println
in classPrintStream
-
println
public void println(boolean f) Print a boolean and then terminate the line. This method behaves as though it invokes
and thenprint(boolean)
.println()
- Overrides:
println
in classPrintStream
- Parameters:
f
- Theboolean
to be printed
-
println
public void println(char ch) Print a character and then terminate the line. This method behaves as though it invokes
and thenprint(char)
.println()
- Overrides:
println
in classPrintStream
- Parameters:
ch
- Thechar
to be printed.
-
println
public void println(int i) Print an integer and then terminate the line. This method behaves as though it invokes
and thenprint(int)
.println()
- Overrides:
println
in classPrintStream
- Parameters:
i
- Theint
to be printed.
-
println
public void println(long l) Print a long and then terminate the line. This method behaves as though it invokes
and thenprint(long)
.println()
- Overrides:
println
in classPrintStream
- Parameters:
l
- a Thelong
to be printed.
-
println
public void println(float fl) Print a float and then terminate the line. This method behaves as though it invokes
and thenprint(float)
.println()
- Overrides:
println
in classPrintStream
- Parameters:
fl
- Thefloat
to be printed.
-
println
public void println(double dfl) Print a double and then terminate the line. This method behaves as though it invokes
and thenprint(double)
.println()
- Overrides:
println
in classPrintStream
- Parameters:
dfl
- Thedouble
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
and thenprint(char[])
.println()
- Overrides:
println
in classPrintStream
- Parameters:
ach
- an array of chars to print.
-
println
Print a String and then terminate the line. This method behaves as though it invokes
and thenprint(String)
.println()
- Overrides:
println
in classPrintStream
- Parameters:
s
- TheString
to be printed.
-
println
Print an Object and then terminate the line. This method behaves as though it invokes
and thenprint(Object)
.println()
- Overrides:
println
in classPrintStream
- Parameters:
o
- TheObject
to be printed.
-