|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fudgemsg.FudgeMsgFormatter
public class FudgeMsgFormatter
Tool to pretty-print a Fudge message.
Field Summary | |
---|---|
static int |
DEFAULT_INDENT
The default indent (number of spaces) |
Constructor Summary | |
---|---|
FudgeMsgFormatter(PrintWriter writer)
Creates a new pretty printer with a default indent. |
|
FudgeMsgFormatter(PrintWriter writer,
int indent)
Creates a new pretty printer with a specific indent. |
|
FudgeMsgFormatter(Writer writer)
Creates a new pretty printer with a default indent. |
|
FudgeMsgFormatter(Writer writer,
int indent)
Creates a new pretty printer with a specific indent. |
Method Summary | |
---|---|
void |
format(FudgeFieldContainer msg)
Pretty-prints a Fudge message. |
protected void |
format(FudgeFieldContainer msg,
int depth)
Pretty-prints a Fudge message with the given left hand indent. |
protected void |
format(FudgeField field,
int index,
int depth,
String fieldSpec,
int maxFieldSpecWidth,
int maxTypeNameWidth)
Lays out and writes a field description and value on a line to the output device. |
protected String |
getFieldSpec(FudgeField field,
int index,
int depth)
Describes the fields name and ordinal. |
protected int |
getFieldSpecWidth(FudgeField field,
int index,
int depth)
Calculates the length of a description (name + ordinal) of the field. |
int |
getIndent()
Gets the size of the indent. |
protected String |
getTypeName(FudgeFieldType<?> type)
Creates a string type name for a Fudge type. |
PrintWriter |
getWriter()
Gets the target to output to. |
static void |
outputToSystemOut(FudgeFieldContainer msg)
Writes a Fudge message to System.out . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_INDENT
Constructor Detail |
---|
public FudgeMsgFormatter(Writer writer)
writer
- the target to write to, not nullpublic FudgeMsgFormatter(PrintWriter writer)
writer
- the target to write to, not nullpublic FudgeMsgFormatter(Writer writer, int indent)
writer
- the target to write to, not nullindent
- the number of spaces to use for indentation, not negativepublic FudgeMsgFormatter(PrintWriter writer, int indent)
writer
- the target to write to, not nullindent
- the number of spaces to use for indentation, not negativeMethod Detail |
---|
public static void outputToSystemOut(FudgeFieldContainer msg)
System.out
.
msg
- the message to write, not nullpublic PrintWriter getWriter()
public int getIndent()
public void format(FudgeFieldContainer msg)
This outputs the message to the writer passed in the constructor.
msg
- the message to write, null ignoredprotected void format(FudgeFieldContainer msg, int depth)
This outputs the message to the writer passed in the constructor.
msg
- the message to write, null ignoreddepth
- indentation levelprotected int getFieldSpecWidth(FudgeField field, int index, int depth)
field
- the field to describe, not nullindex
- the offset index of the field within the messagedepth
- the indentation level
protected void format(FudgeField field, int index, int depth, String fieldSpec, int maxFieldSpecWidth, int maxTypeNameWidth)
field
- the field to describe, not nullindex
- the offset index of the field within the messagedepth
- the indentation levelfieldSpec
- the field description (name + ordinal)maxFieldSpecWidth
- the maximum length (in characters) of all fieldSpec
s within the messagemaxTypeNameWidth
- the maximum length (in characters) of all type names within the messageprotected String getFieldSpec(FudgeField field, int index, int depth)
field
- the field to describeindex
- the offset index into the containing messagedepth
- the indentation level
protected String getTypeName(FudgeFieldType<?> type)
type
- the Fudge type
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |