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.

Author

Mark Reinhold

Since

1.1

See also

CharArrayWriter
FilterWriter
FileWriter
PipedWriter

Inheritors

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun append(c: Char): Writer

Appends the specified character to this writer.

open override fun append(csq: CharSequence?): Writer

Appends the specified character sequence to this writer.

open override fun append(csq: CharSequence?, start: Int, end: Int): Writer

Appends a subsequence of the specified character sequence to this writer.

Link copied to clipboard
abstract override fun close()

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.

Link copied to clipboard
abstract override fun flush()

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.

Link copied to clipboard
open fun write(cbuf: CharArray)

Writes an array of characters.

open fun write(c: Int)

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.

open fun write(str: String)

Writes a string.

abstract fun write(cbuf: CharArray, off: Int, len: Int)

Writes a portion of an array of characters.

open fun write(str: String, off: Int, len: Int)

Writes a portion of a string.