java.io.PrintWriter
Prints formatted representations of objects to a text-output stream. This class implements all of the print methods found in PrintStream. It does not contain strategies for writing raw bytes, for which a program should use unencoded byte streams.
Unlike the PrintStream class, if automatic flushing is enabled it will be done only when one of the println, printf, or format methods is invoked, rather than whenever a newline character happens to be output. These methods use the platform's notion of line separator rather than the newline character.
Implemented Interfaces:
Closeable
Flushable
Appendable
AutoCloseable
Some methods of PrintWriter class
append(char): This method appends the specified character to this writer.
append(CharSequence): This method appends the specified character sequence to this writer.
append(CharSequence, int, int): This method appends a subsequence of the specified character sequence to this writer.
checkError(): This method flushes the stream if it's not closed and checks its error state.
close(): This method closes the stream and releases any system resources associated with it.
flush(): This method flushes the stream.
format(String, Object...): This method writes a formatted string to this writer using the specified format string and arguments.
format(Locale, String, Object...): This method writes a formatted string to this writer using the specified format string and arguments.
print(boolean): This method prints a boolean value.
printf(String, Object...): It is a convenient method to write a formatted string to this writer using the specified format string and arguments.
printf(Locale, String, Object...): It is a convenient method to write a formatted string to this writer using the specified format string and arguments.
println(): This method terminates the current line by writing the line separator string.
PrintWriter(File): This method creates a new PrintWriter, without automatic line flushing, with the specified file.
PrintWriter(Writer, boolean): This method creates a new PrintWriter.
PrintWriter(OutputStream, boolean, Charset): This method creates a new PrintWriter from an existing OutputStream.
PrintWriter(OutputStream): This method creates a new PrintWriter, without automatic line flushing, from an existing OutputStream.
PrintWriter(String): This method creates a new PrintWriter, without automatic line flushing, with the specified file name.
PrintWriter(Writer): This method creates a new PrintWriter, without automatic line flushing.
PrintWriter(File, Charset): This method creates a new PrintWriter, without automatic line flushing, with the specified file and charset.
PrintWriter(File, String): This method creates a new PrintWriter, without automatic line flushing, with the specified file and charset.
PrintWriter(OutputStream, boolean): This method creates a new PrintWriter from an existing OutputStream.
PrintWriter(String, Charset): This method creates a new PrintWriter, without automatic line flushing, with the specified file name and charset.
PrintWriter(String, String): This method creates a new PrintWriter, without automatic line flushing, with the specified file name and charset.
write(char[]): This method writes an array of characters.
write(int): This method writes a single character.
write(String): This method writes a string
write(char[], int, int): This method writes A Portion of an array of characters.
write(String, int, int): This method writes a portion of a string.
No comments:
Post a Comment