org.apache.commons.net

## Class PrintCommandListener

- java.lang.Object
- - org.apache.commons.net.PrintCommandListener

- All Implemented Interfaces:
    EventListener, ProtocolCommandListener

      public class PrintCommandListener
      extends Object
      implements ProtocolCommandListener

  This is a support class for some example programs. It is a sample implementation of the ProtocolCommandListener interface which just prints out to a specified stream all command/reply traffic.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PrintCommandListener(PrintStream printStream)` Constructs an instance which prints everything using the default Charset.
    `PrintCommandListener(PrintStream printStream, boolean suppressLogin)` Constructs an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
    `PrintCommandListener(PrintStream printStream, boolean suppressLogin, char eolMarker)` Constructs an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
    `PrintCommandListener(PrintStream printStream, boolean suppressLogin, char eolMarker, boolean showDirection)` Constructs an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
    `PrintCommandListener(PrintWriter writer)` Constructs the default instance which prints everything.
    `PrintCommandListener(PrintWriter writer, boolean suppressLogin)` Constructs an instance which optionally suppresses login command text.
    `PrintCommandListener(PrintWriter writer, boolean suppressLogin, char eolMarker)` Constructs an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
    `PrintCommandListener(PrintWriter writer, boolean suppressLogin, char eolMarker, boolean showDirection)` Constructs an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `protocolCommandSent(ProtocolCommandEvent event)` This method is invoked by a ProtocolCommandEvent source after sending a protocol command to a server.
    `void` | `protocolReplyReceived(ProtocolCommandEvent event)` This method is invoked by a ProtocolCommandEvent source after receiving a reply from a server.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PrintCommandListener

          public PrintCommandListener(PrintStream printStream)

      Constructs an instance which prints everything using the default Charset.
      Parameters:
        `printStream` - where to write the commands and responses e.g. System.out

    - #### PrintCommandListener

          public PrintCommandListener(PrintStream printStream,
                                      boolean suppressLogin)

      Constructs an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
      Parameters:
        `printStream` - where to write the commands and responses
        `suppressLogin` - if `true`, only print command name for login

    - #### PrintCommandListener

          public PrintCommandListener(PrintStream printStream,
                                      boolean suppressLogin,
                                      char eolMarker)

      Constructs an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
      Parameters:
        `printStream` - where to write the commands and responses
        `suppressLogin` - if `true`, only print command name for login
        `eolMarker` - if non-zero, add a marker just before the EOL.

    - #### PrintCommandListener

          public PrintCommandListener(PrintStream printStream,
                                      boolean suppressLogin,
                                      char eolMarker,
                                      boolean showDirection)

      Constructs an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
      Parameters:
        `printStream` - where to write the commands and responses
        `suppressLogin` - if `true`, only print command name for login
        `eolMarker` - if non-zero, add a marker just before the EOL.
        `showDirection` - if `true`, add `"> "` or `"< "` as appropriate to the output

    - #### PrintCommandListener

          public PrintCommandListener(PrintWriter writer)

      Constructs the default instance which prints everything.
      Parameters:
        `writer` - where to write the commands and responses

    - #### PrintCommandListener

          public PrintCommandListener(PrintWriter writer,
                                      boolean suppressLogin)

      Constructs an instance which optionally suppresses login command text.
      Parameters:
        `writer` - where to write the commands and responses
        `suppressLogin` - if `true`, only print command name for login

    - #### PrintCommandListener

          public PrintCommandListener(PrintWriter writer,
                                      boolean suppressLogin,
                                      char eolMarker)

      Constructs an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
      Parameters:
        `writer` - where to write the commands and responses
        `suppressLogin` - if `true`, only print command name for login
        `eolMarker` - if non-zero, add a marker just before the EOL.

    - #### PrintCommandListener

          public PrintCommandListener(PrintWriter writer,
                                      boolean suppressLogin,
                                      char eolMarker,
                                      boolean showDirection)

      Constructs an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.
      Parameters:
        `writer` - where to write the commands and responses, not null.
        `suppressLogin` - if `true`, only print command name for login
        `eolMarker` - if non-zero, add a marker just before the EOL.
        `showDirection` - if `true`, add `">` " or `"< "` as appropriate to the output

  - ### Method Detail

    - #### protocolCommandSent

          public void protocolCommandSent(ProtocolCommandEvent event)

      Description copied from interface: `ProtocolCommandListener`
      This method is invoked by a ProtocolCommandEvent source after sending a protocol command to a server.
      Specified by:
        `protocolCommandSent` in interface `ProtocolCommandListener`
      Parameters:
        `event` - The ProtocolCommandEvent fired.

    - #### protocolReplyReceived

          public void protocolReplyReceived(ProtocolCommandEvent event)

      Description copied from interface: `ProtocolCommandListener`
      This method is invoked by a ProtocolCommandEvent source after receiving a reply from a server.
      Specified by:
        `protocolReplyReceived` in interface `ProtocolCommandListener`
      Parameters:
        `event` - The ProtocolCommandEvent fired.