Class java.io.PrintStream
All Packages This Package Previous Next
Class java.io.PrintStream
java.lang.Object
|
+----java.io.OutputStream
|
+----java.io.FilterOutputStream
|
+----java.io.PrintStream
-
public class
PrintStream
-
extends FilterOutputStream
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);
-
Version:
-
1.15, 21 Feb 1995
-
Author:
-
Arthur van Hoff
-
PrintStream(OutputStream)
-
Creates a new PrintStream.
-
PrintStream(OutputStream, boolean)
-
Creates a new PrintStream, with auto flushing.
-
print(Object)
-
Prints an object.
-
print(String)
-
Prints a String.
-
print(char[])
-
Prints an array of characters.
-
print(int)
-
Prints an integer.
-
print(long)
-
Prints a long.
-
print(float)
-
Prints a float.
-
print(double)
-
Prints a double.
-
print(boolean)
-
Prints a boolean.
-
println()
-
Prints a newline.
-
println(Object)
-
Prints an object followed by a newline.
-
println(String)
-
Prints a string followed by a newline.
-
println(char[])
-
Prints an array of characters followed by a newline.
-
println(int)
-
Prints an integer followed by a newline.
-
println(long)
-
Prints a long followed by a newline.
-
println(float)
-
Prints a float followed by a newline.
-
println(double)
-
Prints a double followed by a newline.
-
println(boolean)
-
Prints a boolean followed by a newline.
-
write(int)
-
Writes a byte.
-
write(byte[], int, int)
-
Writes a sub array of bytes.
PrintStream
public PrintStream(OutputStream out)
-
Creates a new PrintStream.
-
Parameters:
-
out
-
the output stream
PrintStream
public PrintStream(OutputStream out,
boolean autoflush)
-
Creates a new PrintStream, with auto flushing.
-
Parameters:
-
out
-
the output stream
-
autoflush
-
if true the stream automatically flushes
its output when a newline character is printed.
write
public void write(int b)
-
Writes a byte. Will block until the byte is actually
written.
-
Parameters:
-
b
-
the byte
-
Throws: IOException
-
i/o error occurred
-
Overrides:
-
write in class FilterOutputStream
write
public void write(byte b[],
int off,
int len)
-
Writes a sub array of bytes. To be efficient it should
be overridden in a subclass.
-
Parameters:
-
b
-
the data to be written
-
off
-
the start offset in the data
-
len
-
the number of bytes that are written
-
Throws: IOException
-
i/o error occurred
-
Overrides:
-
write in class FilterOutputStream
print
public void print(Object obj)
-
Prints an object.
print
public synchronized void print(String s)
-
Prints a String.
print
public synchronized void print(char s[])
-
Prints an array of characters.
print
public void print(int i)
-
Prints an integer.
print
public void print(long l)
-
Prints a long.
print
public void print(float f)
-
Prints a float.
print
public void print(double d)
-
Prints a double.
print
public void print(boolean b)
-
Prints a boolean.
println
public void println()
-
Prints a newline.
println
public synchronized void println(Object obj)
-
Prints an object followed by a newline.
println
public synchronized void println(String s)
-
Prints a string followed by a newline.
println
public synchronized void println(char s[])
-
Prints an array of characters followed by a newline.
println
public synchronized void println(int i)
-
Prints an integer followed by a newline.
println
public synchronized void println(long l)
-
Prints a long followed by a newline.
println
public synchronized void println(float f)
-
Prints a float followed by a newline.
println
public synchronized void println(double d)
-
Prints a double followed by a newline.
println
public synchronized void println(boolean b)
-
Prints a boolean followed by a newline.
All Packages This Package Previous Next