|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.Writer gnu.text.PrettyWriter
public class PrettyWriter
A pretty printer. This code is transcribed from pprint.lisp in Steel Bank Common Lisp, which is again based on the code in CMU Common Lisp.
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
|
boolean |
isPrettyPrinting
|
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 java.io.Writer |
out
|
int |
pendingBlocksCount
Number of startLogicalBlock - number of endLogicalBlock. |
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
PrettyWriter(java.io.Writer out)
|
|
PrettyWriter(java.io.Writer out,
boolean isPrettyPrinting)
|
|
PrettyWriter(java.io.Writer out,
int lineLength)
|
Method Summary | |
---|---|
void |
addIndentation(int amount,
boolean current)
|
void |
clearBuffer()
|
void |
close()
|
void |
endLogicalBlock()
|
void |
endLogicalBlock(java.lang.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 isPrettyPrinting. |
protected int |
getMiserWidth()
|
void |
lineAbbreviationHappened()
|
void |
setColumnNumber(int column)
|
void |
setIndentation(int column)
|
void |
startLogicalBlock(java.lang.String prefix,
boolean perLine,
java.lang.String suffix)
|
void |
write(char[] str)
|
void |
write(char[] str,
int start,
int count)
|
void |
write(int ch)
|
void |
write(java.lang.String str)
|
void |
write(java.lang.String str,
int start,
int count)
|
void |
writeBreak(int kind)
|
Methods inherited from class java.io.Writer |
---|
append, append, append |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.Writer out
public static ThreadLocation lineLengthLoc
public static ThreadLocation miserWidthLoc
public static ThreadLocation indentLoc
public boolean isPrettyPrinting
public static int initialBufferSize
public char[] buffer
public int bufferFillPointer
public int pendingBlocksCount
public static final int NEWLINE_LINEAR
public static final int NEWLINE_LITERAL
public static final int NEWLINE_FILL
public static final int NEWLINE_SPACE
public static final int NEWLINE_MISER
public static final int NEWLINE_MANDATORY
Constructor Detail |
---|
public PrettyWriter(java.io.Writer out)
public PrettyWriter(java.io.Writer out, int lineLength)
public PrettyWriter(java.io.Writer out, boolean isPrettyPrinting)
Method Detail |
---|
public void write(int ch)
write
in class java.io.Writer
public void write(java.lang.String str)
write
in class java.io.Writer
public void write(java.lang.String str, int start, int count)
write
in class java.io.Writer
public void write(char[] str)
write
in class java.io.Writer
public void write(char[] str, int start, int count)
write
in class java.io.Writer
public void setIndentation(int column)
public int enqueue(int kind, int size)
public void enqueueNewline(int kind)
public final void writeBreak(int kind)
public int enqueueIndent(char kind, int amount)
public void addIndentation(int amount, boolean current)
public void startLogicalBlock(java.lang.String prefix, boolean perLine, java.lang.String suffix)
public void endLogicalBlock()
public void endLogicalBlock(java.lang.String suffix)
protected int getMiserWidth()
public void lineAbbreviationHappened()
public void forcePrettyOutput() throws java.io.IOException
java.io.IOException
public void flush()
flush
in interface java.io.Flushable
flush
in class java.io.Writer
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.Writer
java.io.IOException
public int getColumnNumber()
public void setColumnNumber(int column)
public void clearBuffer()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |