public abstract class BlockWriter extends PrintWriter
Description: A convenience class that wraps a PrinWriter instance to provide support for generating nicely aligned attribute. This class is geared towards textual outputs and is used for aligning the outputs in consecutive lines.
The idea is to create virtual blocks of output in a line (i.e. invisible tabbing points) and when a new line is printed tab the output with spaces (or some similar invisible character) to the last tabbing points. Alignment blocks are created in a LIFO fashion that is and you can only align w.r.t. latest block.
This class is an abstract class to provide some general functionality that can be reused in implementations that supports purely textual output or HTML output.
Copyright: Copyright (c) 2008
Company: Clark & Parsia, LLC.
| Constructor and Description |
|---|
BlockWriter(Writer outWriter,
String pad) |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
clearBlocks()
Clear all the blocks previously defined.
|
abstract void |
endBlock()
Ends the _current alignment block.
|
void |
println() |
abstract void |
printSpace() |
abstract void |
startBlock()
Start a new block for alignment.
|
void |
write(char[] buf,
int off,
int len) |
void |
write(int c) |
void |
write(String s,
int off,
int len) |
public abstract void clearBlocks()
public abstract void startBlock()
endBlock() call.public abstract void endBlock()
throws IllegalStateException
IllegalStateException - if there is no block previously created with a startBlock() call.public void println()
println in class PrintWriterpublic void write(int c)
write in class PrintWriterpublic void write(char[] buf,
int off,
int len)
write in class PrintWriterpublic void write(String s, int off, int len)
write in class PrintWriterpublic abstract void printSpace()
Copyright © 2018. All rights reserved.