public final class TwoColumnOutput extends Object
| Constructor and Description |
|---|
TwoColumnOutput(OutputStream out,
int leftWidth,
int rightWidth,
String spacer)
Constructs an instance.
|
TwoColumnOutput(Writer out,
int leftWidth,
int rightWidth,
String spacer)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
public TwoColumnOutput(Writer out, int leftWidth, int rightWidth, String spacer)
out - non-null; writer to send final output toleftWidth - > 0; width of the left column, in charactersrightWidth - > 0; width of the right column, in charactersspacer - non-null; spacer string to sit between the two columnspublic TwoColumnOutput(OutputStream out, int leftWidth, int rightWidth, String spacer)
out - non-null; stream to send final output toleftWidth - >= 1; width of the left column, in charactersrightWidth - >= 1; width of the right column, in charactersspacer - non-null; spacer string to sit between the two columnspublic static String toString(String s1, int width1, String spacer, String s2, int width2)
s1 - non-null; first stringwidth1 - > 0; width of the first columnspacer - non-null; spacer strings2 - non-null; second stringwidth2 - > 0; width of the second columnnon-null; an appropriately-formatted stringpublic Writer getLeft()
non-null; the left column writerpublic Writer getRight()
non-null; the right column writerpublic void flush()
Copyright © 2016. All Rights Reserved.