com.android.dx.util
Class IndentingWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.FilterWriter
          extended by com.android.dx.util.IndentingWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable

public final class IndentingWriter
extends FilterWriter

Writer that wraps another writer and passes width-limited and optionally-prefixed output to its subordinate. When lines are wrapped they are automatically indented based on the start of the line.


Field Summary
 
Fields inherited from class java.io.FilterWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
IndentingWriter(Writer out, int width)
          Constructs a no-prefix instance.
IndentingWriter(Writer out, int width, String prefix)
          Constructs an instance.
 
Method Summary
 void write(char[] cbuf, int off, int len)
          
 void write(int c)
          
 void write(String str, int off, int len)
          
 
Methods inherited from class java.io.FilterWriter
close, flush
 
Methods inherited from class java.io.Writer
append, append, append, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndentingWriter

public IndentingWriter(Writer out,
                       int width,
                       String prefix)
Constructs an instance.

Parameters:
out - non-null; writer to send final output to
width - >= 0; the maximum output width (not including prefix), or 0 for no maximum
prefix - non-null; the prefix for each line

IndentingWriter

public IndentingWriter(Writer out,
                       int width)
Constructs a no-prefix instance.

Parameters:
out - non-null; writer to send final output to
width - >= 0; the maximum output width (not including prefix), or 0 for no maximum
Method Detail

write

public void write(int c)
           throws IOException

Overrides:
write in class FilterWriter
Throws:
IOException

write

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

Overrides:
write in class FilterWriter
Throws:
IOException

write

public void write(String str,
                  int off,
                  int len)
           throws IOException

Overrides:
write in class FilterWriter
Throws:
IOException


Copyright © 2013. All Rights Reserved.