java.lang.Object | +--java.io.OutputStream | +--java.io.FilterOutputStream | +--java.io.PrintStream
PrintStream(java.io.OutputStream out) This method intializes a new |
PrintStream(java.io.OutputStream out, boolean auto_flush) This method intializes a new |
boolean | checkError() This method checks to see if an error has occurred on this stream. |
synchronized void | close() This method closes this stream and all underlying streams. |
void | flush() This method flushes any buffered bytes to the underlying stream and then flushes that stream as well. |
void | print(boolean b) This methods prints a boolean value to the stream. |
void | print(char c) This method prints a char to the stream. |
void | print(int i) This method prints an integer to the stream. |
void | print(long l) This method prints a long to the stream. |
void | print(float f) This method prints a float to the stream. |
void | print(double d) This method prints a double to the stream. |
void | print(char[] s) This method prints an array of characters to the stream. |
void | print(java.lang.String s) This method prints a |
void | print(java.lang.Object obj) This method prints an |
void | println() This method prints a line separator sequence to the stream. |
void | println(boolean b) This methods prints a boolean value to the stream. |
void | println(char c) This method prints a char to the stream. |
void | println(int i) This method prints an integer to the stream. |
void | println(long l) This method prints a long to the stream. |
void | println(float f) This method prints a float to the stream. |
void | println(double d) This method prints a double to the stream. |
void | println(char[] s) This method prints an array of characters to the stream. |
void | println(java.lang.String s) This method prints a |
void | println(java.lang.Object obj) This method prints an |
void | setError() This method can be called by subclasses to indicate that an error
has occurred and should be reported by |
synchronized void | write(int b) This method writes a byte of data to the stream. |
synchronized void | write(byte[] buf, int offset, int len) This method writes |
public PrintStream(java.io.OutputStream out)
PrintStream
object to write
to the specified output sink. Note that this class is deprecated in
favor of PrintWriter
.
out
- The OutputStream
to write to.public PrintStream(java.io.OutputStream out, boolean auto_flush)
PrintStream
object to write
to the specified output sink. This constructor also allows "auto-flush"
functionality to be specified where the stream will be flushed after
every line is terminated or newline character is written.
Note that this class is deprecated in favor of PrintWriter
.
out
- The OutputStream
to write to.auto_flush
- true to flush the stream after every line, false
otherwisepublic boolean checkError()
true
forever for this stream. Before checking for an
error condition, this method flushes the stream.
true
if an error has occurred, false
otherwisepublic synchronized void close()
public void flush()
public void print(boolean b)
true
values are printed as "true" and false
values are printed
as "false".
b
- The boolean
value to printpublic void print(char c)
c
- The char
value to be printedpublic void print(char[] s)
s
- The array of characters to print.public void print(double d)
String.valueOf()
method.
d
- The double
value to be printedpublic void print(float f)
String.valueOf()
method.
f
- The float
value to be printedpublic void print(int i)
String.valueOf()
method.
i
- The int
value to be printedpublic void print(java.lang.Object obj)
Object
to the stream. The actual
value printed is determined by calling the String.valueOf()
method.
obj
- The Object
to print.public void print(java.lang.String s)
String
to the stream. The actual
value printed depends on the system default encoding.
s
- The String
to print.public void print(long l)
String.valueOf()
method.
l
- The long
value to be printedpublic void println()
public void println(boolean b)
true
values are printed as "true" and false
values are printed
as "false".
This method prints a line termination sequence after printing the value.
b
- The boolean
value to printpublic void println(char c)
This method prints a line termination sequence after printing the value.
c
- The char
value to be printedpublic void println(char[] s)
This method prints a line termination sequence after printing the value.
s
- The array of characters to print.public void println(double d)
String.valueOf()
method.
This method prints a line termination sequence after printing the value.
d
- The double
value to be printedpublic void println(float f)
String.valueOf()
method.
This method prints a line termination sequence after printing the value.
f
- The float
value to be printedpublic void println(int i)
String.valueOf()
method.
This method prints a line termination sequence after printing the value.
i
- The int
value to be printedpublic void println(java.lang.Object obj)
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.
obj
- The Object
to print.public void println(java.lang.String s)
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.
s
- The String
to print.public void println(long l)
String.valueOf()
method.
This method prints a line termination sequence after printing the value.
l
- The long
value to be printedprotected void setError()
checkError
.
public synchronized void write(byte[] buf, int offset, int len)
len
bytes from the specified array
starting at index offset
into the array.
buf
- The array of bytes to writeoffset
- The index into the array to start writing fromlen
- The number of bytes to writepublic synchronized void write(int b)
b
- The byte to be written
checkError()
method. Additionally, this stream can be designated as "autoflush" when created so that any writes are automatically flushed to the underlying output sink when the current line is terminated.Note that this class is deprecated. It exists for backward compatibility only. New code should be written to use
PrintWriter
instead.This class converts char's into byte's using the system default encoding.