Package org.apache.commons.net
Class PrintCommandListener
java.lang.Object
org.apache.commons.net.PrintCommandListener
- All Implemented Interfaces:
EventListener
,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.
- Since:
- 2.0
-
Constructor Summary
ConstructorDescriptionPrintCommandListener
(PrintStream stream) Create the default instance which prints everything.PrintCommandListener
(PrintStream stream, boolean suppressLogin) Create an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.PrintCommandListener
(PrintStream stream, boolean suppressLogin, char eolMarker) Create an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.PrintCommandListener
(PrintStream stream, boolean suppressLogin, char eolMarker, boolean showDirection) Create an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.PrintCommandListener
(PrintWriter writer) Create the default instance which prints everything.PrintCommandListener
(PrintWriter writer, boolean suppressLogin) Create an instance which optionally suppresses login command text.PrintCommandListener
(PrintWriter writer, boolean suppressLogin, char eolMarker) Create 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) Create an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character. -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is invoked by a ProtocolCommandEvent source after sending a protocol command to a server.void
This method is invoked by a ProtocolCommandEvent source after receiving a reply from a server.
-
Constructor Details
-
PrintCommandListener
Create the default instance which prints everything.- Parameters:
stream
- where to write the commands and responses e.g. System.out- Since:
- 3.0
-
PrintCommandListener
Create an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.- Parameters:
stream
- where to write the commands and responsessuppressLogin
- iftrue
, only print command name for login- Since:
- 3.0
-
PrintCommandListener
Create an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.- Parameters:
stream
- where to write the commands and responsessuppressLogin
- iftrue
, only print command name for logineolMarker
- if non-zero, add a marker just before the EOL.- Since:
- 3.0
-
PrintCommandListener
public PrintCommandListener(PrintStream stream, boolean suppressLogin, char eolMarker, boolean showDirection) Create an instance which optionally suppresses login command text and indicates where the EOL starts with the specified character.- Parameters:
stream
- where to write the commands and responsessuppressLogin
- iftrue
, only print command name for logineolMarker
- if non-zero, add a marker just before the EOL.showDirection
- iftrue
, add"> "
or"< "
as appropriate to the output- Since:
- 3.0
-
PrintCommandListener
Create the default instance which prints everything.- Parameters:
writer
- where to write the commands and responses
-
PrintCommandListener
Create an instance which optionally suppresses login command text.- Parameters:
writer
- where to write the commands and responsessuppressLogin
- iftrue
, only print command name for login- Since:
- 3.0
-
PrintCommandListener
Create 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 responsessuppressLogin
- iftrue
, only print command name for logineolMarker
- if non-zero, add a marker just before the EOL.- Since:
- 3.0
-
PrintCommandListener
public PrintCommandListener(PrintWriter writer, boolean suppressLogin, char eolMarker, boolean showDirection) Create 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 responsessuppressLogin
- iftrue
, only print command name for logineolMarker
- if non-zero, add a marker just before the EOL.showDirection
- iftrue
, add">
" or"< "
as appropriate to the output- Since:
- 3.0
-
-
Method Details
-
protocolCommandSent
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 interfaceProtocolCommandListener
- Parameters:
event
- The ProtocolCommandEvent fired.
-
protocolReplyReceived
Description copied from interface:ProtocolCommandListener
This method is invoked by a ProtocolCommandEvent source after receiving a reply from a server.- Specified by:
protocolReplyReceived
in interfaceProtocolCommandListener
- Parameters:
event
- The ProtocolCommandEvent fired.
-