public abstract class BlockWriter extends PrintWriter
Title:
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.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
newLine |
protected String |
pad |
out| Constructor and Description |
|---|
BlockWriter(Writer out,
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.
|
protected abstract void |
startNewLine()
Do the preprocessing step required at the beginning of each line for
alignment;
|
void |
write(char[] buf,
int off,
int len) |
void |
write(int c) |
void |
write(String s,
int off,
int len) |
append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, setError, write, writeprotected String pad
protected boolean newLine
protected abstract void startNewLine()
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 © 2019. All rights reserved.