gnu.text
public class PrettyWriter extends Writer
Field Summary | |
---|---|
char[] | buffer Holds all the text that has been output but not yet printed. |
int | bufferFillPointer The index into BUFFER where more text should be put. |
static ThreadLocation | indentLoc |
static int | initialBufferSize |
static ThreadLocation | lineLengthLoc |
static ThreadLocation | miserWidthLoc |
static int | NEWLINE_FILL |
static int | NEWLINE_LINEAR |
static int | NEWLINE_LITERAL |
static int | NEWLINE_MANDATORY |
static int | NEWLINE_MISER |
static int | NEWLINE_SPACE A non-nested ' ' gets an implicit NEWLINE_SPACE.
|
protected Writer | out |
int | pendingBlocksCount Number of startLogicalBlock - number of endLogicalBlock. |
Constructor Summary | |
---|---|
PrettyWriter(Writer out) | |
PrettyWriter(Writer out, int lineLength) | |
PrettyWriter(Writer out, boolean prettyPrintingMode) |
Method Summary | |
---|---|
void | addIndentation(int amount, boolean current) |
void | clearBuffer() |
void | clearWordEnd() |
void | close() |
void | endLogicalBlock() |
void | endLogicalBlock(String suffix) |
int | enqueue(int kind, int size) |
int | enqueueIndent(char kind, int amount) |
void | enqueueNewline(int kind) |
void | flush() |
void | forcePrettyOutput() |
int | getColumnNumber() Not meaningful if {@code prettyPrintingMode > 0}. |
protected int | getMiserWidth() |
int | getPrettyPrintingMode() Return pretty-printing mode. |
boolean | isPrettyPrinting() Is pretty printing enabled? |
void | lineAbbreviationHappened() |
void | setColumnNumber(int column) |
void | setIndentation(int column) |
void | setPrettyPrinting(boolean mode) Turn pretty printing on or off.
|
void | setPrettyPrintingMode(int mode) Control pretty-printing mode. |
void | startLogicalBlock(String prefix, boolean perLine, String suffix) |
void | write(int ch) |
void | write(String str) |
void | write(String str, int start, int count) |
void | write(char[] str) |
void | write(char[] str, int start, int count) |
void | writeBreak(int kind) |
void | writeWordEnd() Note the end of a "word". |
void | writeWordStart() Maybe write a word-separating space.
|
Returns: 0, 1, 2, as described for {@link #setPrettyPrintingMode(int)}.
Parameters: mode the value 0 disables pretty-printing; the value 1 enables ecplicit pretty-printing; the value 2 enables pretty-printing with auto-fill, which means that spaces are treated like enqueing NEWLINE_SPACE (essentiall a 'fill').