abstract class Writer
Abstract class for writing to character streams. The only methods that a subclass must implement are write(char[], int, int), flush(), and close(). Most subclasses, however, will override some of the methods defined here in order to provide higher efficiency, additional functionality, or both.
See Also
Writer
Author
Mark Reinhold
Since
JDK1.1
Writer()
Creates a new character-stream writer whose critical sections will synchronize on the writer itself. Writer(lock: Any?)
Creates a new character-stream writer whose critical sections will synchronize on the given object. |
var lock: Any
The object used to synchronize operations on this stream. For efficiency, a character-stream object may use an object other than itself to protect critical sections. A subclass should therefore use the object in this field rather than this or a synchronized method. |
fun append(csq: CharSequence?): Writer
Appends the specified character sequence to this writer. fun append(csq: CharSequence?, start: Int, end: Int): Writer
Appends a subsequence of the specified character sequence to this writer. Appendable. fun append(c: Char): Writer
Appends the specified character to this writer. |
|
abstract fun close(): Unit
Closes the stream, flushing it first. Once the stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously closed stream has no effect. |
|
abstract fun flush(): Unit
Flushes the stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams. |
|
open fun write(c: Int): Unit
Writes a single character. The character to be written is contained in the 16 low-order bits of the given integer value; the 16 high-order bits are ignored. fun write(cbuf: CharArray): Unit
Writes an array of characters. abstract fun write(cbuf: CharArray, off: Int, len: Int): Unit
Writes a portion of an array of characters. fun write(str: String): Unit
Writes a string. open fun write(str: String, off: Int, len: Int): Unit
Writes a portion of a string. |