org.jnetpcap.packet.format
Class TextFormatter

java.lang.Object
  extended by org.jnetpcap.packet.format.JFormatter
      extended by org.jnetpcap.packet.format.TextFormatter

public class TextFormatter
extends JFormatter

Formatter that formats packet content for human readable output. This class produces pretty text based output by reading field objects from the header.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jnetpcap.packet.format.JFormatter
JFormatter.Detail, JFormatter.Priority, JFormatter.Style
 
Field Summary
 
Fields inherited from class org.jnetpcap.packet.format.JFormatter
frameIndex, out
 
Constructor Summary
TextFormatter()
           
TextFormatter(java.lang.Appendable out)
          Creates a test formatter which send its output to an appendable output device
TextFormatter(java.lang.StringBuilder out)
          Creates a text formatter which sends its output to a string buffer
 
Method Summary
protected  void analysisAfter(JHeader header, JAnalysis analysis, JFormatter.Detail detail)
           
protected  void analysisBefore(JHeader header, JAnalysis analysis, JFormatter.Detail detail)
           
protected  void fieldAfter(JHeader header, JField field, JFormatter.Detail detail)
           
protected  void fieldBefore(JHeader header, JField field, JFormatter.Detail detail)
           
protected  void headerAfter(JHeader header, JFormatter.Detail detail)
          Called as the last step after the header has been formatted
protected  void headerBefore(JHeader header, JFormatter.Detail detail)
          Called as the first step before the header has been formatted
 void packetAfter(JPacket packet, JFormatter.Detail detail)
           
 void packetBefore(JPacket packet, JFormatter.Detail detail)
           
protected  void packetNull(JPacket packet, JFormatter.Detail detail)
           
protected  void subAnalysisBefore(JHeader header, JAnalysis analysis, JAnalysis subAnalysis, JFormatter.Detail detail)
           
protected  void subHeaderAfter(JHeader header, JHeader subHeader, JFormatter.Detail detail)
           
protected  void subHeaderBefore(JHeader header, JHeader subHeader, JFormatter.Detail detail)
           
 
Methods inherited from class org.jnetpcap.packet.format.JFormatter
decLevel, fieldNull, format, format, format, format, format, format, format, format, format, format, getDefault, headerNull, incLevel, incLevel, incLevel, pad, printf, println, reset, setDefault, setDefaultDisplayPayload, setDefaultResolveAddress, setDetail, setDetail, setDisplayPayload, setFrameIndex, setOutput, setOutput, setResolveAddresses, stylizeMultiLine, stylizeMultiLine, stylizeSingleLine, subAnalysisAfter, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextFormatter

public TextFormatter()

TextFormatter

public TextFormatter(java.lang.Appendable out)
Creates a test formatter which send its output to an appendable output device

Parameters:
out - where to send output

TextFormatter

public TextFormatter(java.lang.StringBuilder out)
Creates a text formatter which sends its output to a string buffer

Parameters:
out - buffer where to send output
Method Detail

analysisAfter

protected void analysisAfter(JHeader header,
                             JAnalysis analysis,
                             JFormatter.Detail detail)
                      throws java.io.IOException
Overrides:
analysisAfter in class JFormatter
Throws:
java.io.IOException

analysisBefore

protected void analysisBefore(JHeader header,
                              JAnalysis analysis,
                              JFormatter.Detail detail)
                       throws java.io.IOException
Overrides:
analysisBefore in class JFormatter
Throws:
java.io.IOException

subAnalysisBefore

protected void subAnalysisBefore(JHeader header,
                                 JAnalysis analysis,
                                 JAnalysis subAnalysis,
                                 JFormatter.Detail detail)
                          throws java.io.IOException
Overrides:
subAnalysisBefore in class JFormatter
Throws:
java.io.IOException

fieldAfter

protected void fieldAfter(JHeader header,
                          JField field,
                          JFormatter.Detail detail)
                   throws java.io.IOException
Specified by:
fieldAfter in class JFormatter
Throws:
java.io.IOException

fieldBefore

protected void fieldBefore(JHeader header,
                           JField field,
                           JFormatter.Detail detail)
                    throws java.io.IOException
Specified by:
fieldBefore in class JFormatter
Throws:
java.io.IOException

headerAfter

protected void headerAfter(JHeader header,
                           JFormatter.Detail detail)
                    throws java.io.IOException
Description copied from class: JFormatter
Called as the last step after the header has been formatted

Specified by:
headerAfter in class JFormatter
Parameters:
header - headercurrently being formatted
detail - detail level to include
Throws:
java.io.IOException - any IO errors while sending data to output device

headerBefore

protected void headerBefore(JHeader header,
                            JFormatter.Detail detail)
                     throws java.io.IOException
Description copied from class: JFormatter
Called as the first step before the header has been formatted

Specified by:
headerBefore in class JFormatter
Parameters:
header - headercurrently being formatted
detail - detail level to include
Throws:
java.io.IOException - any IO errors while sending data to output device

packetAfter

public void packetAfter(JPacket packet,
                        JFormatter.Detail detail)
                 throws java.io.IOException
Specified by:
packetAfter in class JFormatter
Throws:
java.io.IOException

packetBefore

public void packetBefore(JPacket packet,
                         JFormatter.Detail detail)
                  throws java.io.IOException
Specified by:
packetBefore in class JFormatter
Throws:
java.io.IOException

packetNull

protected void packetNull(JPacket packet,
                          JFormatter.Detail detail)
Overrides:
packetNull in class JFormatter

subHeaderAfter

protected void subHeaderAfter(JHeader header,
                              JHeader subHeader,
                              JFormatter.Detail detail)
                       throws java.io.IOException
Specified by:
subHeaderAfter in class JFormatter
Throws:
java.io.IOException

subHeaderBefore

protected void subHeaderBefore(JHeader header,
                               JHeader subHeader,
                               JFormatter.Detail detail)
                        throws java.io.IOException
Specified by:
subHeaderBefore in class JFormatter
Throws:
java.io.IOException