Java Writer
Java Writer
is an abstract class for writing character streams, and it provides several methods to write character data to different destinations.
Here are some of the methods available in the Writer
class:
write(int c)
: This method writes a single character to the output stream.write(char[] cbuf)
: This method writes characters from thecbuf
character array to the output stream.write(char[] cbuf, int off, int len)
: This method writes up tolen
characters from thecbuf
character array, starting at the specifiedoff
offset, to the output stream.write(String str)
: This method writes the characters of the specifiedstr
string to the output stream.write(String str, int off, int len)
: This method writes up tolen
characters from the specifiedstr
string, starting at the specifiedoff
offset, to the output stream.append(char c)
: This method appends a single character to the output stream and returns the writer itself.append(CharSequence csq)
: This method appends the characters of the specifiedcsq
character sequence to the output stream and returns the writer itself.append(CharSequence csq, int start, int end)
: This method appends the specified range of characters from thecsq
character sequence to the output stream and returns the writer itself.flush()
: This method flushes the output stream, meaning that any buffered characters are written to their intended destination.close()
: This method closes the output stream and releases any system resources associated with it.