Class StringW

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

public class StringW extends Object implements Writer
Writer that constructs an in-memory String.
  • Constructor Details

    • StringW

      public StringW()
  • Method Details

    • write

      public void write(char ch)
      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
    • write

      public void write(String str)
      Description copied from interface: Writer
      Writes a string.
      Specified by:
      write in interface Writer
      Parameters:
      str - String to be written
    • 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()
      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
    • close

      public void close()
      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
    • toString

      public String toString()
      Overrides:
      toString in class Object