public final class TwoColumnOutput
extends java.lang.Object
| Constructor and Description |
|---|
TwoColumnOutput(java.io.OutputStream out,
int leftWidth,
int rightWidth,
java.lang.String spacer)
Constructs an instance.
|
TwoColumnOutput(java.io.Writer out,
int leftWidth,
int rightWidth,
java.lang.String spacer)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
flush()
Flushes the output.
|
java.io.Writer |
getLeft()
Gets the writer to use to write to the left column.
|
java.io.Writer |
getRight()
Gets the writer to use to write to the right column.
|
static java.lang.String |
toString(java.lang.String s1,
int width1,
java.lang.String spacer,
java.lang.String s2,
int width2)
Turns the given two strings (with widths) and spacer into a formatted
two-column string.
|
public TwoColumnOutput(java.io.Writer out,
int leftWidth,
int rightWidth,
java.lang.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(java.io.OutputStream out,
int leftWidth,
int rightWidth,
java.lang.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 java.lang.String toString(java.lang.String s1,
int width1,
java.lang.String spacer,
java.lang.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 java.io.Writer getLeft()
non-null; the left column writerpublic java.io.Writer getRight()
non-null; the right column writerpublic void flush()
Copyright © 2020. All Rights Reserved.