|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jnetpcap.packet.format.JFormatter
public abstract class JFormatter
Formats decoded contents of a JPacket for output.
| Nested Class Summary | |
|---|---|
static class |
JFormatter.Detail
Detail level to include in formatted output. |
static class |
JFormatter.Priority
Priority assigned to JFields. |
static class |
JFormatter.Style
Various output formatting styles for JField values. |
| Field Summary | |
|---|---|
protected int |
frameIndex
The frame index. |
protected java.util.Formatter |
out
The out. |
| Constructor Summary | |
|---|---|
JFormatter()
Instantiates a new j formatter. |
|
JFormatter(java.lang.Appendable out)
Creates a formatter. |
|
JFormatter(java.lang.StringBuilder out)
Creates a formatter. |
|
| Method Summary | |
|---|---|
protected void |
decLevel()
Dec level. |
protected abstract void |
fieldAfter(JHeader header,
JField field,
JFormatter.Detail detail)
Field after. |
protected abstract void |
fieldBefore(JHeader header,
JField field,
JFormatter.Detail detail)
Field before. |
protected void |
fieldNull(JHeader header,
JField field,
JFormatter.Detail detail)
Field null. |
void |
format(JHeader header)
Format. |
void |
format(JHeader header,
JField field)
Format. |
void |
format(JHeader header,
JField field,
JFormatter.Detail detail)
Format. |
void |
format(JHeader header,
JFormatter.Detail detail)
Format. |
void |
format(JHeader header,
JHeader subHeader,
JFormatter.Detail detail)
Format. |
void |
format(JPacket packet)
Format. |
void |
format(JPacket packet,
JFormatter.Detail detail)
Formats a packet for output. |
void |
format(java.lang.StringBuilder out,
JPacket packet)
Formats a packet for output. |
static JFormatter |
getDefault()
Gets the default formatter. |
protected abstract void |
headerAfter(JHeader header,
JFormatter.Detail detail)
Called as the last step after the header has been formatted. |
protected abstract void |
headerBefore(JHeader header,
JFormatter.Detail detail)
Called as the first step before the header has been formatted. |
protected void |
headerNull(JHeader header,
JFormatter.Detail detail)
Header null. |
protected void |
incLevel(int count)
Increment the padding level using default padding string. |
protected void |
incLevel(int count,
char c)
Inc level. |
protected void |
incLevel(java.lang.String pad)
Inc level. |
abstract void |
packetAfter(JPacket packet,
JFormatter.Detail detail)
Packet after. |
abstract void |
packetBefore(JPacket packet,
JFormatter.Detail detail)
Packet before. |
protected void |
packetNull(JPacket packet,
JFormatter.Detail detail)
Packet null. |
protected java.util.Formatter |
pad()
Appends a string, a pad, to the beginning of the line. |
void |
printf(java.lang.String format,
java.lang.Object... args)
Printf. |
void |
println(java.lang.String text)
Println. |
void |
reset()
If the current output device is a StringBuilder, it resets the buffer. |
static void |
setDefault(JFormatter formatter)
Sets the default. |
static void |
setDefaultDisplayPayload(boolean enable)
Sets a global flag that will enable or disable display of payload header in a packet. |
static void |
setDefaultResolveAddress(boolean enable)
Sets the default resolve address. |
void |
setDetail(JFormatter.Detail detail)
Changes the detail level that is displayed with formatted output. |
void |
setDetail(JFormatter.Detail detail,
int id)
Changes the detail level that is displayed for formatted output for a specific header type. |
void |
setDisplayPayload(boolean enable)
Sets weather the payload header will be part of the display of a packet. |
void |
setFrameIndex(int index)
Sets the packet frame number, as an index. |
void |
setOutput(java.lang.Appendable out)
Changes the output device for this formatter. |
void |
setOutput(java.lang.StringBuilder out)
Changes the output device for this formatter. |
void |
setResolveAddresses(boolean enable)
Sets a flag which will enable address resolutions. |
protected java.lang.String[] |
stylizeMultiLine(JHeader header,
JField field,
JFormatter.Style style,
java.lang.Object value)
Stylize multi line. |
protected java.lang.String[] |
stylizeMultiLine(JHeader header,
JField field,
java.lang.Object value)
Stylize multi line. |
protected java.lang.String |
stylizeSingleLine(JHeader header,
JField field,
java.lang.Object value)
Stylize single line. |
protected abstract void |
subHeaderAfter(JHeader header,
JHeader subHeader,
JFormatter.Detail detail)
Sub header after. |
protected abstract void |
subHeaderBefore(JHeader header,
JHeader subHeader,
JFormatter.Detail detail)
Sub header before. |
java.lang.String |
toString()
To string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int frameIndex
protected java.util.Formatter out
| Constructor Detail |
|---|
public JFormatter()
public JFormatter(java.lang.Appendable out)
out - appendable device where to send outputpublic JFormatter(java.lang.StringBuilder out)
out - buffer where to send output| Method Detail |
|---|
public static JFormatter getDefault()
public static void setDefault(JFormatter formatter)
formatter - the new defaultpublic static void setDefaultDisplayPayload(boolean enable)
enable - true will enable display of payload header otherwise disablesetDisplayPayload(boolean)public static void setDefaultResolveAddress(boolean enable)
enable - the new default resolve addressprotected void decLevel()
protected abstract void fieldAfter(JHeader header,
JField field,
JFormatter.Detail detail)
throws java.io.IOException
header - the headerfield - the fielddetail - the detail
java.io.IOException - Signals that an I/O exception has occurred.
protected abstract void fieldBefore(JHeader header,
JField field,
JFormatter.Detail detail)
throws java.io.IOException
header - the headerfield - the fielddetail - the detail
java.io.IOException - Signals that an I/O exception has occurred.
protected void fieldNull(JHeader header,
JField field,
JFormatter.Detail detail)
header - the headerfield - the fielddetail - the detail
public void format(JHeader header)
throws java.io.IOException
header - the header
java.io.IOException - Signals that an I/O exception has occurred.
public void format(JHeader header,
JFormatter.Detail detail)
throws java.io.IOException
header - the headerdetail - the detail
java.io.IOException - Signals that an I/O exception has occurred.
public void format(JHeader header,
JField field)
throws java.io.IOException
header - the headerfield - the field
java.io.IOException - Signals that an I/O exception has occurred.
public void format(JHeader header,
JField field,
JFormatter.Detail detail)
throws java.io.IOException
header - the headerfield - the fielddetail - the detail
java.io.IOException - Signals that an I/O exception has occurred.
public void format(JHeader header,
JHeader subHeader,
JFormatter.Detail detail)
throws java.io.IOException
header - the headersubHeader - the sub headerdetail - the detail
java.io.IOException - Signals that an I/O exception has occurred.
public void format(JPacket packet)
throws java.io.IOException
packet - the packet
java.io.IOException - Signals that an I/O exception has occurred.
public void format(JPacket packet,
JFormatter.Detail detail)
throws java.io.IOException
packet - packet to formatdetail - detail level
java.io.IOException - any IO errors when sending data to default output device
public void format(java.lang.StringBuilder out,
JPacket packet)
out - string buffer to send output topacket - packet to format
protected abstract void headerAfter(JHeader header,
JFormatter.Detail detail)
throws java.io.IOException
header - headercurrently being formatteddetail - detail level to include
java.io.IOException - any IO errors while sending data to output device
protected abstract void headerBefore(JHeader header,
JFormatter.Detail detail)
throws java.io.IOException
header - headercurrently being formatteddetail - detail level to include
java.io.IOException - any IO errors while sending data to output device
protected void headerNull(JHeader header,
JFormatter.Detail detail)
header - the headerdetail - the detailprotected void incLevel(int count)
count - numer of pad strings to pad
protected void incLevel(int count,
char c)
count - the countc - the cprotected void incLevel(java.lang.String pad)
pad - the pad
public abstract void packetAfter(JPacket packet,
JFormatter.Detail detail)
throws java.io.IOException
packet - the packetdetail - the detail
java.io.IOException - Signals that an I/O exception has occurred.
public abstract void packetBefore(JPacket packet,
JFormatter.Detail detail)
throws java.io.IOException
packet - the packetdetail - the detail
java.io.IOException - Signals that an I/O exception has occurred.
protected void packetNull(JPacket packet,
JFormatter.Detail detail)
packet - the packetdetail - the detailprotected java.util.Formatter pad()
public void reset()
public void setDetail(JFormatter.Detail detail)
detail - the level of detail to set for all headers
public void setDetail(JFormatter.Detail detail,
int id)
detail - the level of detail set for this particular headerid - header idpublic void setDisplayPayload(boolean enable)
enable - if true will include payload header in the display, otherwise it
will notsetDefaultDisplayPayload(boolean)public void setFrameIndex(int index)
index - initial index for frame numberpublic void setOutput(java.lang.Appendable out)
out - new formatter devicepublic void setOutput(java.lang.StringBuilder out)
out - new formatter devicepublic void setResolveAddresses(boolean enable)
enable - true to enable address resolution, otherwise false
setDefaultResolveAddress(boolean).setDefaultResolveAddress(boolean)
protected java.lang.String[] stylizeMultiLine(JHeader header,
JField field,
java.lang.Object value)
header - the headerfield - the fieldvalue - the value
protected java.lang.String[] stylizeMultiLine(JHeader header,
JField field,
JFormatter.Style style,
java.lang.Object value)
header - the headerfield - the fieldstyle - the stylevalue - the value
protected java.lang.String stylizeSingleLine(JHeader header,
JField field,
java.lang.Object value)
header - the headerfield - the fieldvalue - the value
protected abstract void subHeaderAfter(JHeader header,
JHeader subHeader,
JFormatter.Detail detail)
throws java.io.IOException
header - the headersubHeader - the sub headerdetail - the detail
java.io.IOException - Signals that an I/O exception has occurred.
protected abstract void subHeaderBefore(JHeader header,
JHeader subHeader,
JFormatter.Detail detail)
throws java.io.IOException
header - the headersubHeader - the sub headerdetail - the detail
java.io.IOException - Signals that an I/O exception has occurred.public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public void println(java.lang.String text)
text - the text
public void printf(java.lang.String format,
java.lang.Object... args)
format - the formatargs - the args
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||