Class FastStringWriter

    • Constructor Detail

      • FastStringWriter

        public FastStringWriter()

        Constructs a new FastStringWriter instance using the default capacity of 16.

      • FastStringWriter

        public FastStringWriter​(int initialCapacity)

        Constructs a new FastStringWriter instance using the specified initialCapacity.

        Parameters:
        initialCapacity - specifies the initial capacity of the buffer
        Throws:
        IllegalArgumentException - if initialCapacity is less than zero
    • Method Detail

      • write

        public void write​(char[] cbuf,
                          int off,
                          int len)
                   throws IOException

        Write a portion of an array of characters.

        Specified by:
        write in class Writer
        Parameters:
        cbuf - Array of characters
        off - Offset from which to start writing characters
        len - Number of characters to write
        Throws:
        IOException
      • write

        public void write​(String str)
        Write a string.
        Overrides:
        write in class Writer
        Parameters:
        str - String to be written
      • write

        public void write​(String str,
                          int off,
                          int len)
        Write a portion of a string.
        Overrides:
        write in class Writer
        Parameters:
        str - A String
        off - Offset from which to start writing characters
        len - Number of characters to write
      • getBuffer

        public StringBuilder getBuffer()
        Return the StringBuilder itself.
        Returns:
        StringBuilder holding the current buffer value.
      • toString

        public String toString()
        Overrides:
        toString in class Object
        Returns:
        the buffer's current value as a string.
      • reset

        public void reset()