All Packages Class Hierarchy This Package Previous Next Index
Class java.io.PrintStream
java.lang.Object
|
+----java.io.OutputStream
|
+----java.io.FilterOutputStream
|
+----java.io.PrintStream
- public class PrintStream
- extends FilterOutputStream
Print values and objects to a byte stream, using the platform's default
character encoding to convert characters into bytes. You can specify that
the stream should be flushed every time a newline character is written.
Note: This class is provided primarily for use in debugging,
and for compatibility with existing code; new code should use the
PrintWriter class.
- See Also:
- PrintWriter
-
PrintStream(OutputStream)
- Create a new PrintStream.
Deprecated.
-
PrintStream(OutputStream, boolean)
- Create a new PrintStream.
Deprecated.
-
checkError()
- Flush the stream and check its error state.
-
close()
- Close the stream.
-
flush()
- Flush the stream, writing any buffered output bytes.
-
print(boolean)
- Print a boolean.
-
print(char)
- Print a character.
-
print(char[])
- Print an array of chracters.
-
print(double)
- Print a double.
-
print(float)
- Print a float.
-
print(int)
- Print an integer.
-
print(long)
- Print a long.
-
print(Object)
- Print an object.
-
print(String)
- Print a String.
-
println()
- Finish the line.
-
println(boolean)
- Print a boolean, and then finish the line.
-
println(char)
- Print a character, and then finish the line.
-
println(char[])
- Print an array of characters, and then finish the line.
-
println(double)
- Print a double, and then finish the line.
-
println(float)
- Print a float, and then finish the line.
-
println(int)
- Print an integer, and then finish the line.
-
println(long)
- Print a long, and then finish the line.
-
println(Object)
- Print an Object, and then finish the line.
-
println(String)
- Print a String, and then finish the line.
-
setError()
- Indicate that an error has occurred
-
write(byte[], int, int)
- Write a portion of a byte array, blocking if necessary.
-
write(int)
- Write a byte, blocking if necessary.
PrintStream
public PrintStream(OutputStream out)
- Note: PrintStream() is deprecated.
As of JDK version 1.1, the preferred way to print text is
via the PrintWriter class.
- Create a new PrintStream.
- Parameters:
- out - An output stream
- See Also:
- PrintWriter
PrintStream
public PrintStream(OutputStream out,
boolean autoFlush)
- Note: PrintStream() is deprecated.
As of JDK version 1.1, the preferred way to print text is
via the PrintWriter class.
- Create a new PrintStream.
- Parameters:
- out - An output stream
- autoFlush - A boolean; if true, the println() methods will flush
the output buffer
- See Also:
- PrintWriter
flush
public void flush()
- Flush the stream, writing any buffered output bytes.
- Overrides:
- flush in class FilterOutputStream
close
public void close()
- Close the stream.
- Overrides:
- close in class FilterOutputStream
checkError
public boolean checkError()
- Flush the stream and check its error state. Errors are cumulative;
once the stream encounters an error, this routine will continue to
return true on all successive calls.
- Returns:
- True if the print stream has encountered an error, either on the
underlying output stream or during a format conversion.
setError
protected void setError()
- Indicate that an error has occurred
write
public void write(int b)
- Write a byte, blocking if necessary. Note that the byte is written as
given; to write a character via the stream's character-to-byte
converter, use the print() or println() methods.
- Parameters:
- b - The byte to be written
- Throws: IOException
- If an I/O error occurs
- Overrides:
- write in class FilterOutputStream
- See Also:
- print, println
write
public void write(byte buf[],
int off,
int len)
- Write a portion of a byte array, blocking if necessary.
- Parameters:
- buf - A byte array
- off - Offset from which to start reading bytes
- len - Number of bytes to write
- Throws: IOException
- If an I/O error occurs
- Overrides:
- write in class FilterOutputStream
print
public void print(boolean b)
- Print a boolean.
print
public void print(char c)
- Print a character.
print
public void print(int i)
- Print an integer.
print
public void print(long l)
- Print a long.
print
public void print(float f)
- Print a float.
print
public void print(double d)
- Print a double.
print
public void print(char s[])
- Print an array of chracters.
print
public void print(String s)
- Print a String.
print
public void print(Object obj)
- Print an object.
println
public void println()
- Finish the line.
println
public void println(boolean x)
- Print a boolean, and then finish the line.
println
public void println(char x)
- Print a character, and then finish the line.
println
public void println(int x)
- Print an integer, and then finish the line.
println
public void println(long x)
- Print a long, and then finish the line.
println
public void println(float x)
- Print a float, and then finish the line.
println
public void println(double x)
- Print a double, and then finish the line.
println
public void println(char x[])
- Print an array of characters, and then finish the line.
println
public void println(String x)
- Print a String, and then finish the line.
println
public void println(Object x)
- Print an Object, and then finish the line.
All Packages Class Hierarchy This Package Previous Next Index