Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |
java.lang.Object | +----java.io.OutputStream | +----java.io.FilterOutputStream | +----java.io.PrintStream
If automatic flushing is enabled at creation time, then the stream will be flushed each time a line is terminated or a newline character is written.
Methods in this class never throw I/O exceptions. Client code may
inquire as to whether any errors have occurred by invoking the
checkError
method.
Note: This class is provided primarily for use in debugging, and for compatibility with existing code; new code should use the PrintWriter class.
Fields inherited from class java.io.FilterOutputStream |
out |
Constructor Summary | |
PrintStream(OutputStream out)
|
|
PrintStream(OutputStream out,
boolean autoFlush)
|
Method Summary | |
boolean | checkError()
|
void | close()
|
void | flush()
|
void | print(boolean b)
|
void | print(char c)
|
void | print(int i)
|
void | print(long l)
|
void | print(float f)
|
void | print(double d)
|
void | print(char[] s)
|
void | print(String s)
|
void | print(Object obj)
|
void | println()
|
void | println(boolean x)
|
void | println(char x)
|
void | println(int x)
|
void | println(long x)
|
void | println(float x)
|
void | println(double x)
|
void | println(char[] x)
|
void | println(String x)
|
void | println(Object x)
|
void | setError()
|
void | write(int b)
|
void | write(byte[] buf,
int off,
int len)
|
Methods inherited from class java.io.FilterOutputStream |
close, flush, write, write, write |
Methods inherited from class java.io.OutputStream |
close, flush, write, write, 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)
PrintStream p = new PrintStream(out);
PrintWriter p = new PrintWriter(out);
out
- The output stream to which values and objects will be
printed
public PrintStream(OutputStream out, boolean autoFlush)
PrintStream p = new PrintStream(out, autoFlush);
PrintWriter p = new PrintWriter(out, autoFlush);
out
- The output stream to which values and objects will be
printed
autoFlush
- A boolean; if true, the output buffer will be flushed
whenever a line is terminated or a newline character
('\n'
) is written
Method Detail |
public void flush()
public void close()
public boolean checkError()
protected void setError()
public void write(int b)
flush
method
will be called.
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)
or println(char)
methods.
b
- The byte to be written
public void write(byte[] buf, int off, int len)
buf
- A byte array
off
- Offset from which to start taking bytes
len
- Number of bytes to write
public void print(boolean b)
"true"
is written to the underlying output stream;
otherwise, the string "false"
is written.
b
- The boolean
to be printed
public void print(char c)
c
- The char
to be printed
public void print(int i)
toString
method of the Integer
class when
invoked on the given int
value.
i
- The int
to be printed
public void print(long l)
toString
method of the Long
class when
invoked on the given long
value.
l
- The long
to be printed
public void print(float f)
toString
method of the Float
class when invoked on the given float
value.
f
- The float
to be printed
public void print(double d)
toString
method of the
Double
class when invoked on the given double
value.
d
- The double
to be printed
public void print(char[] s)
s
- The array of chars to be printed
public void print(String s)
null
, the string
"null"
is written to the underlying output stream.
Otherwise, the string's characters are converted into bytes according to
the platform's default character encoding.
s
- The String
to be printed
public void print(Object obj)
toString
method.
obj
- The Object
to be printed
public void println()
line.separator
, and is not necessarily a single newline
character ('\n'
).public void println(boolean x)
public void println(char x)
public void println(int x)
public void println(long x)
public void println(float x)
public void println(double x)
public void println(char[] x)
public void println(String x)
public void println(Object x)
Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |