com.android.dx.util
Class TwoColumnOutput

java.lang.Object
  extended by com.android.dx.util.TwoColumnOutput

public final class TwoColumnOutput
extends Object

Class that takes a combined output destination and provides two output writers, one of which ends up writing to the left column and one which goes on the right.


Constructor Summary
TwoColumnOutput(OutputStream out, int leftWidth, int rightWidth, String spacer)
          Constructs an instance.
TwoColumnOutput(Writer out, int leftWidth, int rightWidth, String spacer)
          Constructs an instance.
 
Method Summary
 void flush()
          Flushes the output.
 Writer getLeft()
          Gets the writer to use to write to the left column.
 Writer getRight()
          Gets the writer to use to write to the right column.
static String toString(String s1, int width1, String spacer, String s2, int width2)
          Turns the given two strings (with widths) and spacer into a formatted two-column string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwoColumnOutput

public TwoColumnOutput(Writer out,
                       int leftWidth,
                       int rightWidth,
                       String spacer)
Constructs an instance.

Parameters:
out - non-null; writer to send final output to
leftWidth - > 0; width of the left column, in characters
rightWidth - > 0; width of the right column, in characters
spacer - non-null; spacer string to sit between the two columns

TwoColumnOutput

public TwoColumnOutput(OutputStream out,
                       int leftWidth,
                       int rightWidth,
                       String spacer)
Constructs an instance.

Parameters:
out - non-null; stream to send final output to
leftWidth - >= 1; width of the left column, in characters
rightWidth - >= 1; width of the right column, in characters
spacer - non-null; spacer string to sit between the two columns
Method Detail

toString

public static String toString(String s1,
                              int width1,
                              String spacer,
                              String s2,
                              int width2)
Turns the given two strings (with widths) and spacer into a formatted two-column string.

Parameters:
s1 - non-null; first string
width1 - > 0; width of the first column
spacer - non-null; spacer string
s2 - non-null; second string
width2 - > 0; width of the second column
Returns:
non-null; an appropriately-formatted string

getLeft

public Writer getLeft()
Gets the writer to use to write to the left column.

Returns:
non-null; the left column writer

getRight

public Writer getRight()
Gets the writer to use to write to the right column.

Returns:
non-null; the right column writer

flush

public void flush()
Flushes the output. If there are more lines of pending output in one column, then the other column will get filled with blank lines.



Copyright © 2013. All Rights Reserved.