- All Known Implementing Classes:
StringW,WriterAdapter
public interface Writer
A character stream producer.
For compatibility with GWT, the native Java Writer
implementation cannot be used.
- See Also:
-
Method Summary
-
Method Details
-
write
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.Subclasses that intend to support efficient single-character output should override this method.
- Parameters:
ch- int specifying a character to be written- Throws:
IOException- If an I/O error occurs
-
write
Writes a string.- Parameters:
str- String to be written- Throws:
IOException- If an I/O error occurs
-
write
Writes a portion of a string.- Parameters:
str- A Stringstart- Offset from which to start writing characterslength- Number of characters to write- Throws:
IndexOutOfBoundsException- If off is negative, or len is negative, or off+len is negative or greater than the length of the given stringIOException- If an I/O error occurs
-
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.- Throws:
IOException- If an I/O error occurs
-
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.- Throws:
IOException- If an I/O error occurs
-