- java.lang.Object
-
- de.haumacher.msgbuf.server.io.WriterAdapter
-
- All Implemented Interfaces:
Writer
public final class WriterAdapter extends Object implements Writer
- Author:
- Bernhard Haumacher
-
-
Constructor Summary
Constructors Constructor Description WriterAdapter(Writer out)Creates aWriterAdapter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the stream, flushing it first.voidflush()Flushes the stream.voidwrite(char ch)Writes a single character.voidwrite(String str, int start, int length)Writes a portion of a string.
-
-
-
Constructor Detail
-
WriterAdapter
public WriterAdapter(Writer out)
Creates aWriterAdapter.
-
-
Method Detail
-
write
public void write(char ch) throws IOExceptionDescription copied from interface:WriterWrites 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.
- Specified by:
writein interfaceWriter- Parameters:
ch- int specifying a character to be written- Throws:
IOException- If an I/O error occurs
-
write
public void write(String str, int start, int length) throws IOException
Description copied from interface:WriterWrites a portion of a string.- Specified by:
writein interfaceWriter- Parameters:
str- A Stringstart- Offset from which to start writing characterslength- Number of characters to write- Throws:
IOException- If an I/O error occurs
-
flush
public void flush() throws IOExceptionDescription copied from interface:WriterFlushes 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.- Specified by:
flushin interfaceWriter- Throws:
IOException- If an I/O error occurs
-
close
public void close() throws IOExceptionDescription copied from interface:WriterCloses 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.- Specified by:
closein interfaceWriter- Throws:
IOException- If an I/O error occurs
-
-