Class WriterAdapter

java.lang.Object
de.haumacher.msgbuf.server.io.WriterAdapter
All Implemented Interfaces:
Writer

public final class WriterAdapter extends Object implements Writer
Adapter to use a Writer as Writer.
Author:
Bernhard Haumacher
  • Constructor Details

  • Method Details

    • write

      public void write(char ch) throws IOException
      Description copied from interface: Writer
      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.

      Specified by:
      write in interface Writer
      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: Writer
      Writes a portion of a string.
      Specified by:
      write in interface Writer
      Parameters:
      str - A String
      start - Offset from which to start writing characters
      length - Number of characters to write
      Throws:
      IOException - If an I/O error occurs
    • flush

      public void flush() throws IOException
      Description copied from interface: Writer
      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.
      Specified by:
      flush in interface Writer
      Throws:
      IOException - If an I/O error occurs
    • close

      public void close() throws IOException
      Description copied from interface: Writer
      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.
      Specified by:
      close in interface Writer
      Throws:
      IOException - If an I/O error occurs