Class IndentedLineWriter

    • Constructor Detail

      • IndentedLineWriter

        public IndentedLineWriter​(Writer out)
        Constructs a stream which will add spaces in front of each line.
        Parameters:
        out - The underlying stream to write to.
    • Method Detail

      • getIdentation

        public int getIdentation()
        Returns the current indentation.
        Returns:
        The current indentation.
      • setIndentation

        public void setIndentation​(int width)
        Sets the indentation to the specified value.
        Parameters:
        width - The new indentation.
      • beginNewLine

        protected void beginNewLine()
                             throws IOException
        Invoked when a new line is begining. The default implementation writes the amount of spaces specified by the last call to setIndentation(int).
        Throws:
        IOException - If an I/O error occurs
      • write

        public void write​(char[] buffer,
                          int offset,
                          int length)
                   throws IOException
        Writes a portion of an array of characters.
        Overrides:
        write in class FilterWriter
        Parameters:
        buffer - Buffer of characters to be written.
        offset - Offset from which to start reading characters.
        length - Number of characters to be written.
        Throws:
        IOException - If an I/O error occurs.
      • write

        public void write​(String string,
                          int offset,
                          int length)
                   throws IOException
        Writes a portion of a string.
        Overrides:
        write in class FilterWriter
        Parameters:
        string - String to be written.
        offset - Offset from which to start reading characters.
        length - Number of characters to be written.
        Throws:
        IOException - If an I/O error occurs.