📅  最后修改于: 2020-11-15 02:53:43             🧑  作者: Mango
Java.io.Writer类是用于写入字符流的抽象类。
以下是Java.io.Writer类的声明-
public abstract class Writer
extends Object
implements Appendable, Closeable, Flushable
以下是Java.io.Writer类的字段-
protected Object lock-这是用于同步此流上的操作的对象。
Sr.No. | Constructor & Description |
---|---|
1 |
protected Writer() This creates a new character-stream writer whose critical sections will synchronize on the writer itself. |
2 |
protected Writer(Object lock) This creates a new character-stream writer whose critical sections will synchronize on the given object. |
Sr.No. | Method & Description |
---|---|
1 | Writer append(char c)
This method appends the specified character to this writer. |
2 | Writer append(CharSequence csq)
This method appends the specified character sequence to this writer. |
3 | Writer append(CharSequence csq, int start, int end)
This method appends a subsequence of the specified character sequence to this writer. |
4 | abstract void close()
This method loses the stream, flushing it first. |
5 | abstract void flush()
This method flushes the stream. |
6 | void write(char[] cbuf)
This method writes an array of characters. |
7 | abstract void write(char[] cbuf, int off, int len)
This method writes a portion of an array of characters. |
8 | void write(int c)
This method writes a single character. |
9 | void write(String str)
This method writes a string. |
10 | void write(String str, int off, int len)
This method writes a portion of a string. |
此类从以下类继承方法-