|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.Writer | +--java.io.PrintWriter | +--jimmc.roots.MultiColumnPrintStream
Provides support for multi-column output, assuming a fixed-width font. After instantiating, use the addColumn method to define the print columns and their characteristics. Use selectColumn to select a column, then just call the normal PrintWriter methods such as println to add data to that column. Use flushColumns to get all columns back into alignment, and use selectDirect to print directly to the output (e.g. to print data that spans all columns).
Fields inherited from class java.io.PrintWriter |
out |
Fields inherited from class java.io.Writer |
lock |
Constructor Summary | |
MultiColumnPrintStream(java.io.OutputStream out)
Create a new MultiColumnPrintStream. |
|
MultiColumnPrintStream(java.io.Writer out)
Create a new MultiColumnPrintStream. |
Method Summary | |
int |
addColumn(int width,
int spacing)
Add an output column. |
boolean |
anyColumnHasData(int col)
See if any column starting after a given point has any data. |
void |
flush()
Flush all columns, then flush the underlying stream. |
void |
flushColumns()
Flush out the data from all columns. |
void |
outputCompleteLines()
Output as many complete lines from all columns as possible. |
void |
printlnc(java.lang.String s)
Conditional println: print text to the output, add a newline if the last character is not already a newline. |
void |
selectColumn(int col)
Select the column to which output is directed. |
void |
selectDirect()
Flush and deselect all columns. |
void |
write(char[] b,
int off,
int len)
Write a sub array of chars to the currently selected column. |
void |
write(int b)
Write a char to the currently selected column. |
void |
write(java.lang.String s,
int off,
int len)
Write a substring to the currently selected column. |
Methods inherited from class java.io.PrintWriter |
checkError, close, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, println, setError, write, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MultiColumnPrintStream(java.io.OutputStream out)
out
- the output streampublic MultiColumnPrintStream(java.io.Writer out)
out
- the output streamMethod Detail |
public int addColumn(int width, int spacing)
width
- the width of the column in print positionsspacing
- the number of blank characters between this
column and the next column.public void selectColumn(int col)
col
- the column index as returned by addColumn.public void selectDirect()
public void flushColumns()
public void outputCompleteLines()
public boolean anyColumnHasData(int col)
colnum
- index of the first column to checkpublic void flush()
flush
in class java.io.PrintWriter
public void printlnc(java.lang.String s)
public void write(int b)
write
in class java.io.PrintWriter
b
- the charpublic void write(char[] b, int off, int len)
write
in class java.io.PrintWriter
b
- the data to be writtenoff
- the start offset in the datalen
- the number of chars to writepublic void write(java.lang.String s, int off, int len)
write
in class java.io.PrintWriter
s
- the string to be writtenoff
- the start offset in the stringlen
- the number of chars to write
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |