public class TextWriter extends Writer
| Constructor and Description |
|---|
TextWriter(OutputStream out,
boolean autoFlush,
TextCodec codec) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkError()
This method checks to see if an error has occurred on this stream.
|
void |
close()
This method closes the stream.
|
void |
flush()
This method flushes any buffered chars to the underlying stream and
then flushes that stream as well.
|
void |
print(boolean bool)
This methods prints a boolean value to the stream.
|
void |
print(char ch)
This method prints a char to the stream.
|
void |
print(char[] charArray)
This method prints an array of characters to the stream.
|
void |
print(double dnum)
This method prints a double to the stream.
|
void |
print(float fnum)
This method prints a float to the stream.
|
void |
print(int inum)
This method prints an integer to the stream.
|
void |
print(long lnum)
This method prints a long to the stream.
|
void |
print(Object obj)
This method prints an
Object to the stream. |
void |
print(String str)
This method prints a
String to the stream. |
void |
println()
This method prints a line separator sequence to the stream.
|
void |
println(boolean bool)
This methods prints a boolean value to the stream.
|
void |
println(char ch)
This method prints a char to the stream.
|
void |
println(char[] charArray)
This method prints an array of characters to the stream.
|
void |
println(double dnum)
This method prints a double to the stream.
|
void |
println(float fnum)
This method prints a float to the stream.
|
void |
println(int inum)
This method prints an integer to the stream.
|
void |
println(long lnum)
This method prints a long to the stream.
|
void |
println(Object obj)
This method prints an
Object to the stream. |
void |
println(String str)
This method prints a
String to the stream. |
protected void |
setError()
This method can be called by subclasses to indicate that an error
has occurred and should be reported by
checkError. |
void |
write(char[] charArray)
This method write all the chars in the specified array to the output.
|
void |
write(char[] text,
int offset,
int len)
This method writes
len char from the specified array
buf starting at index offset into the array. |
void |
write(int ch)
This method writes a single char to the stream.
|
void |
write(String str)
This method writes the contents of the specified
String
to the underlying stream. |
void |
write(String str,
int offset,
int count)
This method writes
count chars from the specified
String to the output starting at character position
offset into the String |
public TextWriter(OutputStream out, boolean autoFlush, TextCodec codec)
public void close()
WriterThis method in this class does nothing.
public void write(char[] text,
int offset,
int len)
Writerlen char from the specified array
buf starting at index offset into the array.
Subclasses must provide an implementation of this abstract method.
protected void setError()
checkError.public 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 void flush()
public void print(String str)
String to the stream. The actual
value printed depends on the system default encoding.str - The String to print.public void print(char ch)
ch - The char value to be printedpublic void print(char[] charArray)
charArray - The array of characters to print.public void print(boolean bool)
true
values are printed as "true" and false values are printed
as "false".bool - The boolean value to printpublic void print(int inum)
String.valueOf() method.inum - The int value to be printedpublic void print(long lnum)
String.valueOf() method.lnum - The long value to be printedpublic void print(float fnum)
String.valueOf() method.fnum - The float value to be printedpublic void print(double dnum)
String.valueOf() method.dnum - The double value to be printedpublic void print(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 println()
public void println(boolean bool)
true
values are printed as "true" and false values are printed
as "false".
This method prints a line termination sequence after printing the value.bool - The boolean value to printpublic void println(int inum)
String.valueOf() method.
This method prints a line termination sequence after printing the value.inum - The int value to be printedpublic void println(long lnum)
String.valueOf() method.
This method prints a line termination sequence after printing the value.lnum - The long value to be printedpublic void println(float fnum)
String.valueOf() method.
This method prints a line termination sequence after printing the value.fnum - The float value to be printedpublic void println(double dnum)
String.valueOf() method.
This method prints a line termination sequence after printing the value.dnum - The double value to be printedpublic void println(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(String str)
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.str - The String to print.public void println(char ch)
ch - The char value to be printedpublic void println(char[] charArray)
charArray - The array of characters to print.public void write(int ch)
public void write(String str, int offset, int count)
count chars from the specified
String to the output starting at character position
offset into the Stringpublic void write(char[] charArray)