PrintWriter (Java SE 26 & JDK 26)
- All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable
-
Field Summary
Fields
The underlying character-output stream of this
PrintWriter. -
Constructor Summary
Constructors
Creates a new PrintWriter, without automatic line flushing, with the specified file.
Creates a new PrintWriter, without automatic line flushing, with the specified file and charset.
Creates a new PrintWriter, without automatic line flushing, with the specified file and charset.
Creates a new PrintWriter, without automatic line flushing, from an existing OutputStream.
Creates a new PrintWriter from an existing OutputStream.
Creates a new PrintWriter from an existing OutputStream.
Creates a new PrintWriter, without automatic line flushing.
PrintWriter(Writer out, boolean autoFlush) Creates a new PrintWriter.
Creates a new PrintWriter, without automatic line flushing, with the specified file name.
Creates a new PrintWriter, without automatic line flushing, with the specified file name and charset.
Creates a new PrintWriter, without automatic line flushing, with the specified file name and charset.
-
Method Summary
append(char c) Appends the specified character to this writer.
Appends the specified character sequence to this writer.
Appends a subsequence of the specified character sequence to this writer.
booleanFlushes the stream if it's not closed and checks its error state.
protected voidClears the error state of this stream.
voidclose()Closes the stream and releases any system resources associated with it.
voidflush()Writes a formatted string to this writer using the specified format string and arguments.
Writes a formatted string to this writer using the specified format string and arguments.
voidprint(boolean b) voidprint(char c) voidprint(char[] s) Prints an array of characters.
voidprint(double d) Prints a double-precision floating-point number.
voidprint(float f) Prints a floating-point number.
voidprint(int i) voidprint(long l) voidvoidA convenience method to write a formatted string to this writer using the specified format string and arguments.
A convenience method to write a formatted string to this writer using the specified format string and arguments.
voidprintln()Terminates the current line by writing the line separator string.
voidprintln(boolean x) Prints a boolean value and then terminates the line.
voidprintln(char x) Prints a character and then terminates the line.
voidprintln(char[] x) Prints an array of characters and then terminates the line.
voidprintln(double x) Prints a double-precision floating-point number and then terminates the line.
voidprintln(float x) Prints a floating-point number and then terminates the line.
voidprintln(int x) Prints an integer and then terminates the line.
voidprintln(long x) Prints a long integer and then terminates the line.
voidPrints an Object and then terminates the line.
voidPrints a String and then terminates the line.
protected voidsetError()Sets the error state of the stream to
true.voidwrite(char[] buf) Writes an array of characters.
voidwrite(char[] buf, int off, int len) Writes A Portion of an array of characters.
voidwrite(int c) Writes a single character.
voidvoidwrite(String s, int off, int len) Writes a portion of a string.
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitCreates and returns a copy of this object.
booleanIndicates whether some other object is "equal to" this one.
protected voidDeprecated, for removal: This API element is subject to removal in a future version.
Returns the runtime class of this
Object.intReturns a hash code value for this object.
final voidWakes up a single thread that is waiting on this object's monitor.
final voidWakes up all threads that are waiting on this object's monitor.
Returns a string representation of the object.
final voidCauses the current thread to wait until it is awakened, typically by being notified or interrupted.
final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Field Details
-
out
-
-
Constructor Details
-
PrintWriter
-
PrintWriter
-
PrintWriter
-
PrintWriter
-
PrintWriter
-
PrintWriter
-
PrintWriter
-
PrintWriter
-
PrintWriter
-
PrintWriter
-
PrintWriter
-
-
Method Details
-
flush
-
close
-
checkError
-
setError
-
clearError
-
write
-
write
-
write
-
write
-
write
-
print
-
print
-
print
-
print
-
print
-
print
-
print
-
print
-
print
-
println
-
println
-
println
-
println
-
println
-
println
-
println
-
println
-
println
-
println
-
printf
-
printf
-
format
-
format
-
append
-
append
-
append
-