|
|||||||||
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 | +--grace.io.PrintWriter | +--grace.io.FormattedPrintWriter
This class provides a PrintWriter that can be configured generally by a format String.
The formatting operation is as follows. A format string is dictates the way objects are formatted. It is composed of the subformat sections. Each format subsection is separated by a bar ('|') character. So the general format is:
format: header|begin-block|field|end-blockThe header format is used only once, at the beginning of the object dump. It can be used to print one time only header information.
The begin-block format is used just before a sub object is printed. After using this format, the indent level is increased one level.
The field format is used for each field in the object. Formatting is recursive, so if a field is an object, a new sub block is started and the formatting continues recursively. If the field is a primitive value, it is printed simply.
The end-block format is used after a complete sub object has been formatted.
The syntax of the each subformat is as follows:
Fields inherited from class grace.io.PrintWriter |
dateFormat |
Fields inherited from class java.io.PrintWriter |
out |
Fields inherited from class java.io.Writer |
lock |
Constructor Summary | |
FormattedPrintWriter(java.io.OutputStream stream)
|
|
FormattedPrintWriter(java.io.OutputStream stream,
boolean autoFlush)
|
|
FormattedPrintWriter(java.io.Writer writer)
|
|
FormattedPrintWriter(java.io.Writer writer,
boolean autoFlush)
|
Method Summary | |
void |
beginList()
|
void |
beginObject()
|
void |
endList()
|
void |
endObject()
|
protected void |
indent()
|
protected void |
newlineAndIndent()
|
void |
printBeginBlock()
|
protected void |
printBlocking(java.lang.String format)
This formats the blocking of the object - that is the beginning and ending of the text that surrounds an object. |
void |
printEndBlock()
|
protected void |
printField(Value value)
This formats the object based on the fieldFormat string. |
protected void |
printNullObject()
|
protected void |
printNullString()
|
void |
separateListItems()
|
void |
separateObjectItems()
|
void |
setBeginBlockFormat(java.lang.String format)
|
void |
setEndBlockFormat(java.lang.String format)
|
void |
setFieldFormat(java.lang.String format)
|
void |
setFormat(java.lang.String format)
Uses the bar character to separate the beginBlock, field, and endBlock formats. |
void |
setFormat(java.lang.String header,
java.lang.String beginBlock,
java.lang.String field,
java.lang.String endBlock)
Sets the 4 parts of the format. |
void |
setHeaderFormat(java.lang.String format)
|
Methods inherited from class java.io.PrintWriter |
checkError,
close,
flush,
print,
print,
print,
print,
print,
print,
print,
print,
print,
println,
println,
println,
println,
println,
println,
println,
println,
println,
println,
setError,
write,
write,
write,
write,
write |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public FormattedPrintWriter(java.io.OutputStream stream)
public FormattedPrintWriter(java.io.OutputStream stream, boolean autoFlush)
public FormattedPrintWriter(java.io.Writer writer)
public FormattedPrintWriter(java.io.Writer writer, boolean autoFlush)
Method Detail |
public void setFormat(java.lang.String format)
public void setFormat(java.lang.String header, java.lang.String beginBlock, java.lang.String field, java.lang.String endBlock)
public void setHeaderFormat(java.lang.String format)
public void setBeginBlockFormat(java.lang.String format)
public void setFieldFormat(java.lang.String format)
public void setEndBlockFormat(java.lang.String format)
protected void printField(Value value)
This function parses the format:
protected void printBlocking(java.lang.String format)
This function parses the format:
public void printBeginBlock()
public void printEndBlock()
protected void indent()
protected void newlineAndIndent()
public void beginList()
public void endList()
public void beginObject()
public void endObject()
public void separateListItems()
public void separateObjectItems()
protected void printNullString()
protected void printNullObject()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |