Class Overview
IndentingWriter is a BufferedWriter subclass that supports automatic
 indentation of lines of text written to the underlying Writer.
 Methods are provided for compact, convenient indenting, writing text,
 and writing lines in various combinations.
 WARNING: The contents of this source file are not part of any
 supported API.  Code that depends on them does so at its own risk:
 they are subject to change or removal without notice.
 
Summary
| Public Constructors | 
	 
    
        | 
            
            
            
            
            
            
         | 
        
        IndentingWriter(Writer out)
        
         Create a new IndentingWriter that writes indented text to the
 given Writer. 
  
   | 
	 
    
        | 
            
            
            
            
            
            
         | 
        
        IndentingWriter(Writer out, int step)
        
         Create a new IndentingWriter that writes indented text to the
 given Writer and uses the supplied indent step. 
  
   | 
	 
    
        | 
            
            
            
            
            
            
         | 
        
        IndentingWriter(Writer out, int step, int tabSize)
        
         Create a new IndentingWriter that writes indented text to the
 given Writer and uses the supplied indent step and tab size. 
  
   | 
| Public Methods | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        newLine()
        
         Write a line separator. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        p(String s)
        
         Write string. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        p(Object o)
        
         Write Object. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        pI()
        
         Indent in. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        pO()
        
         Indent out. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        pO(String s)
        
         Indent out; write string. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        pO(Object o)
        
         Indent out; write Object. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        pOln(Object o)
        
         Indent out; write Object; end current line. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        pOln(String s)
        
         Indent out; write string; end current line. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        pOlnI(String s)
        
         Indent out; write string; end current line; indent in. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        pOlnI(Object o)
        
         Indent out; write Object; end current line; indent in. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        pln(String s)
        
         Write string; end current line. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        pln()
        
         End current line. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        pln(Object o)
        
         Write Object; end current line. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        plnI(Object o)
        
         Write Object; end current line; indent in. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        plnI(String s)
        
         Write string; end current line; indent in. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        write(char[] cbuf, int off, int len)
        
         Write a portion of an array of characters. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        write(int c)
        
         Write a single character. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        write(String s, int off, int len)
        
         Write a portion of a String. 
  
   | 
| Protected Methods | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        checkWrite()
        
         Check if an indent needs to be written before writing the next
 character. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        indentIn()
        
         Increase the current indent by the indent step. 
  
   | 
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        indentOut()
        
         Decrease the current indent by the indent step. 
  
   | 
| 
  [Expand]
   Inherited Methods  | 
   
From class
  java.io.BufferedWriter
  
   
  
    
    
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        close()
        
         Closes the stream, flushing it first. 
  
   |  
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        flush()
        
         Flushes the stream. 
  
   |  
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        newLine()
        
         Writes a line separator. 
  
   |  
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        write(char[] cbuf, int off, int len)
        
         Writes a portion of an array of characters. 
  
   |  
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        write(String s, int off, int len)
        
         Writes a portion of a String. 
  
   |  
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        write(int c)
        
         Writes a single character. 
  
   |  
 
   
 
 | 
   
From class
  java.io.Writer
  
   
  
    
    
	 
    
        | 
            
            
            
            
            
            Writer
         | 
        
        append(CharSequence csq)
        
         Appends the specified character sequence to this writer. 
  
   |  
	 
    
        | 
            
            
            
            
            
            Writer
         | 
        
        append(CharSequence csq, int start, int end)
        
         Appends a subsequence of the specified character sequence to this writer. 
  
   |  
	 
    
        | 
            
            
            
            
            
            Writer
         | 
        
        append(char c)
        
         Appends the specified character to this writer. 
  
   |  
	 
    
        | 
            abstract
            
            
            
            
            void
         | 
        
        close()
        
         Closes the stream, flushing it first. 
  
   |  
	 
    
        | 
            abstract
            
            
            
            
            void
         | 
        
        flush()
        
         Flushes the stream. 
  
   |  
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        write(char[] cbuf)
        
         Writes an array of characters. 
  
   |  
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        write(String str)
        
         Writes a string. 
  
   |  
	 
    
        | 
            abstract
            
            
            
            
            void
         | 
        
        write(char[] cbuf, int off, int len)
        
         Writes a portion of an array of characters. 
  
   |  
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        write(String str, int off, int len)
        
         Writes a portion of a string. 
  
   |  
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        write(int c)
        
         Writes a single character. 
  
   |  
 
   
 
 | 
   
From class
  java.lang.Object
  
   
  
    
    
	 
    
        | 
            
            
            
            
            
            Object
         | 
        
        clone()
        
         Creates and returns a copy of this object. 
  
   |  
	 
    
        | 
            
            
            
            
            
            boolean
         | 
        
        equals(Object obj)
        
         Indicates whether some other object is "equal to" this one. 
  
   |  
	 
    
        | 
            
            
            
            
            
            void
         | 
        
        finalize()
        
         Called by the garbage collector on an object when garbage collection
 determines that there are no more references to the object. 
  
   |  
	 
    
        | 
            
            
            final
            
            
            Class<?>
         | 
        
        getClass()
        
         Returns the runtime class of this Object. 
  
   |  
	 
    
        | 
            
            
            
            
            
            int
         | 
        
        hashCode()
        
         Returns a hash code value for the object. 
  
   |  
	 
    
        | 
            
            
            final
            
            
            void
         | 
        
        notify()
        
         Wakes up a single thread that is waiting on this object's
 monitor. 
  
   |  
	 
    
        | 
            
            
            final
            
            
            void
         | 
        
        notifyAll()
        
         Wakes up all threads that are waiting on this object's monitor. 
  
   |  
	 
    
        | 
            
            
            
            
            
            String
         | 
        
        toString()
        
         Returns a string representation of the object. 
  
   |  
	 
    
        | 
            
            
            final
            
            
            void
         | 
        
        wait()
        
        Causes the current thread to wait until another thread invokes the
  notify() method or the
  notifyAll() method for this object.  
  
   |  
	 
    
        | 
            
            
            final
            
            
            void
         | 
        
        wait(long timeout, int nanos)
        
        Causes the current thread to wait until another thread invokes the
  notify() method or the
  notifyAll() method for this object, or
 some other thread interrupts the current thread, or a certain
 amount of real time has elapsed.  
  
   |  
	 
    
        | 
            
            
            final
            
            
            void
         | 
        
        wait(long timeout)
        
        Causes the current thread to wait until either another thread invokes the
  notify() method or the
  notifyAll() method for this object, or a
 specified amount of time has elapsed.  
  
   |  
 
   
 
 | 
   
From interface
  java.io.Closeable
  
   
  
    
    
	 
    
        | 
            abstract
            
            
            
            
            void
         | 
        
        close()
        
         Closes this stream and releases any system resources associated
 with it. 
  
   |  
 
   
 
 | 
   
From interface
  java.io.Flushable
  
   
  
    
    
	 
    
        | 
            abstract
            
            
            
            
            void
         | 
        
        flush()
        
         Flushes this stream by writing any buffered output to the underlying
 stream. 
  
   |  
 
   
 
 | 
   
From interface
  java.lang.Appendable
 | 
 
Public Constructors
 
    
      
        public 
         
         
         
         
        
      
      IndentingWriter
      (Writer out)
    
      
    
      
  Create a new IndentingWriter that writes indented text to the
 given Writer.  Use the default indent step of four spaces.
 
     
 
 
    
      
        public 
         
         
         
         
        
      
      IndentingWriter
      (Writer out, int step)
    
      
    
      
  Create a new IndentingWriter that writes indented text to the
 given Writer and uses the supplied indent step.
 
     
 
 
    
      
        public 
         
         
         
         
        
      
      IndentingWriter
      (Writer out, int step, int tabSize)
    
      
    
      
  Create a new IndentingWriter that writes indented text to the
 given Writer and uses the supplied indent step and tab size.
 
     
 
Public Methods
 
    
      
        public 
         
         
         
         
        void
      
      newLine
      ()
    
      
    
      
  Write a line separator.  The next character written will be
 preceded by an indent.
 
  
     
 
 
    
      
        public 
         
         
         
         
        void
      
      pO
      (String s)
    
      
    
      
  Indent out; write string.
 
  
     
 
 
    
      
        public 
         
         
         
         
        void
      
      pO
      (Object o)
    
      
    
      
  Indent out; write Object.
 
  
     
 
 
    
      
        public 
         
         
         
         
        void
      
      pOln
      (Object o)
    
      
    
      
  Indent out; write Object; end current line.
 
  
     
 
 
    
      
        public 
         
         
         
         
        void
      
      pOln
      (String s)
    
      
    
      
  Indent out; write string; end current line.
 
  
     
 
 
    
      
        public 
         
         
         
         
        void
      
      pOlnI
      (String s)
    
      
    
      
  Indent out; write string; end current line; indent in.
 This method is useful for generating lines of code that both
 end and begin nested blocks, like "} else {".
 
  
     
 
 
    
      
        public 
         
         
         
         
        void
      
      pOlnI
      (Object o)
    
      
    
      
  Indent out; write Object; end current line; indent in.
 This method is useful for generating lines of code that both
 end and begin nested blocks, like "} else {".
 
  
     
 
 
    
      
        public 
         
         
         
         
        void
      
      pln
      (String s)
    
      
    
      
  Write string; end current line.
 
  
     
 
 
    
      
        public 
         
         
         
         
        void
      
      pln
      (Object o)
    
      
    
      
  Write Object; end current line.
 
  
     
 
 
    
      
        public 
         
         
         
         
        void
      
      plnI
      (Object o)
    
      
    
      
  Write Object; end current line; indent in.
 
  
     
 
 
    
      
        public 
         
         
         
         
        void
      
      plnI
      (String s)
    
      
    
      
  Write string; end current line; indent in.
 
  
     
 
 
    
      
        public 
         
         
         
         
        void
      
      write
      (char[] cbuf, int off, int len)
    
      
    
      
  Write a portion of an array of characters.
 
  
      Parameters
      
        
          | cbuf
           | A character array | 
        
        
          | off
           | Offset from which to start reading characters | 
        
        
          | len
           | Number of characters to write | 
        
      
   
  
     
 
 
    
      
        public 
         
         
         
         
        void
      
      write
      (int c)
    
      
    
      
  Write a single character.
 
  
      Parameters
      
        
          | c
           | int specifying a character to be written | 
        
      
   
  
     
 
 
    
      
        public 
         
         
         
         
        void
      
      write
      (String s, int off, int len)
    
      
    
      
  Write a portion of a String.
 
  
      Parameters
      
        
          | s
           | String to be written | 
        
        
          | off
           | Offset from which to start reading characters | 
        
        
          | len
           | Number of characters to be written | 
        
      
   
  
     
 
Protected Methods
 
    
      
        protected 
         
         
         
         
        void
      
      checkWrite
      ()
    
      
    
      
  Check if an indent needs to be written before writing the next
 character.
 The indent generation is optimized (and made consistent with
 certain coding conventions) by condensing groups of eight spaces
 into tab characters.
 
  
     
 
 
    
      
        protected 
         
         
         
         
        void
      
      indentIn
      ()
    
      
    
      
  Increase the current indent by the indent step.
 
     
 
 
    
      
        protected 
         
         
         
         
        void
      
      indentOut
      ()
    
      
    
      
  Decrease the current indent by the indent step.