-
- All Known Implementing Classes:
StringW,WriterAdapter
public interface WriterA character stream producer.For compatibility with GWT, the native Java
Writerimplementation cannot be used.- See Also:
WriterAdapter,StringW
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidclose()Closes the stream, flushing it first.voidflush()Flushes the stream.voidwrite(char ch)Writes a single character.default voidwrite(String str)Writes a string.voidwrite(String str, int start, int length)Writes a portion of a string.
-
-
-
Method Detail
-
write
void write(char ch) throws IOExceptionWrites 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
default void write(String str) throws IOException
Writes a string.- Parameters:
str- String to be written- Throws:
IOException- If an I/O error occurs
-
write
void write(String str, int start, int length) throws IOException
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
void flush() throws IOExceptionFlushes 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
void close() throws IOExceptionCloses 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
-
-