|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.io.OutputStream
|
+--java.io.FilterOutputStream
|
+--java.io.PrintStream
This class implements an output stream that has additional methods for printing. You can specify that the stream should be flushed every time a newline character is written.
The top byte of 16 bit characters is discarded.
Example:
System.out.println("Hello world!");
System.out.print("x = ");
System.out.println(x);
System.out.println("y = " + y);
| Field Summary |
| Fields inherited from class java.io.FilterOutputStream |
out |
| Constructor Summary | |
PrintStream(OutputStream out)
Creates a new PrintStream. |
|
PrintStream(OutputStream out,
boolean autoflush)
Creates a new PrintStream, with auto flushing. |
|
| Method Summary | |
boolean |
checkError()
Flushes the print stream and returns whether or not there was an error on the output stream. |
void |
close()
Closes the stream. |
void |
flush()
Flushes the stream. |
void |
print(boolean b)
Prints a boolean. |
void |
print(char c)
Prints an character. |
void |
print(char[] s)
Prints an array of characters. |
void |
print(double d)
Prints a double. |
void |
print(float f)
Prints a float. |
void |
print(int i)
Prints an integer. |
void |
print(long l)
Prints a long. |
void |
print(Object obj)
Prints an object. |
void |
print(String s)
Prints a String. |
void |
println()
Prints a newline. |
void |
println(boolean b)
Prints a boolean followed by a newline. |
void |
println(char c)
Prints a character followed by a newline. |
void |
println(char[] s)
Prints an array of characters followed by a newline. |
void |
println(double d)
Prints a double followed by a newline. |
void |
println(float f)
Prints a float followed by a newline. |
void |
println(int i)
Prints an integer followed by a newline. |
void |
println(long l)
Prints a long followed by a newline. |
void |
println(Object obj)
Prints an object followed by a newline. |
void |
println(String s)
Prints a string followed by a newline. |
void |
write(byte[] b,
int off,
int len)
Writes a sub array of bytes. |
void |
write(int b)
Writes a byte. |
| Methods inherited from class java.io.FilterOutputStream |
write |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PrintStream(OutputStream out)
out - the output stream
public PrintStream(OutputStream out,
boolean autoflush)
out - the output streamautoflush - if true the stream automatically flushes
its output when a newline character is printed| Method Detail |
public void write(int b)
write in class FilterOutputStreamb - the byte
IOException - If an I/O error has occurred.
public void write(byte[] b,
int off,
int len)
write in class FilterOutputStreamb - the data to be writtenoff - the start offset in the datalen - the number of bytes that are written
IOException - If an I/O error has occurred.public void flush()
flush in class FilterOutputStreampublic void close()
close in class FilterOutputStreampublic boolean checkError()
public void print(Object obj)
obj - the object to be printedpublic void print(String s)
s - the String to be printedpublic void print(char[] s)
s - the array of chars to be printedpublic void print(char c)
c - the character to be printedpublic void print(int i)
i - the integer to be printedpublic void print(long l)
l - the long to be printed.public void print(float f)
f - the float to be printedpublic void print(double d)
d - the double to be printedpublic void print(boolean b)
b - the boolean to be printedpublic void println()
public void println(Object obj)
obj - the object to be printedpublic void println(String s)
s - the String to be printedpublic void println(char[] s)
s - the array of characters to be printedpublic void println(char c)
c - the character to be printedpublic void println(int i)
i - the integer to be printedpublic void println(long l)
l - the long to be printedpublic void println(float f)
f - the float to be printedpublic void println(double d)
d - the double to be printedpublic void println(boolean b)
b - the boolean to be printed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||