Class IndentingWriter

    • Constructor Detail

      • IndentingWriter

        public IndentingWriter​(Writer writer,
                               int cSpaces)
        Construct an IndentingWriter that indents a certain number of spaces.
        Parameters:
        writer - the underlying writer to write to
        cSpaces - the number of spaces to indent each line with
      • IndentingWriter

        public IndentingWriter​(Writer writer,
                               String sIndent)
        Construct an IndentingWriter that indents using an indention string.
        Parameters:
        writer - the underlying writer to write to
        sIndent - the String value to indent each line with
    • Method Detail

      • write

        public void write​(int c)
        Write 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.

        Overrides:
        write in class PrintWriter
        Parameters:
        c - int specifying a character to be written.
      • write

        public void write​(char[] cbuf,
                          int off,
                          int len)
        Write a portion of an array of characters.
        Overrides:
        write in class PrintWriter
        Parameters:
        cbuf - Array of characters
        off - Offset from which to start writing characters
        len - Number of characters to write
      • write

        public void write​(String str)
        Write a string.
        Overrides:
        write in class PrintWriter
        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 PrintWriter
        Parameters:
        str - A String
        off - Offset from which to start writing characters
        len - Number of characters to write
      • println

        public void println()
        Terminate the current line by writing the line separator string. The line separator string is defined by the system property line.separator, and is not necessarily a single newline character ('\n').
        Overrides:
        println in class PrintWriter
      • suspend

        public void suspend()
        Suspends indentation.
      • resume

        public void resume()
        Resumes indentation.