Author: sebb
Date: Sat Mar 19 16:14:23 2011
New Revision: 1083208
URL: http://svn.apache.org/viewvc?rev=1083208&view=rev
Log:
Add versions for a PrintStream (e.g. System.out)
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/PrintCommandListener.java
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/PrintCommandListener.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/PrintCommandListener.java?rev=1083208&r1=1083207&r2=1083208&view=diff
==============================================================================
---
commons/proper/net/trunk/src/main/java/org/apache/commons/net/PrintCommandListener.java
(original)
+++
commons/proper/net/trunk/src/main/java/org/apache/commons/net/PrintCommandListener.java
Sat Mar 19 16:14:23 2011
@@ -17,6 +17,7 @@
package org.apache.commons.net;
+import java.io.PrintStream;
import java.io.PrintWriter;
import org.apache.commons.net.ProtocolCommandEvent;
import org.apache.commons.net.ProtocolCommandListener;
@@ -39,6 +40,45 @@ public class PrintCommandListener implem
/**
* Create the default instance which prints everything.
*
+ * @param stream where to write the commands and responses
+ * e.g. System.out
+ * @since 3.0
+ */
+ public PrintCommandListener(PrintStream stream)
+ {
+ this(new PrintWriter(stream));
+ }
+
+ /**
+ * Create an instance which optionally suppresses login command text
+ * and indicates where the EOL starts with the specified character.
+ *
+ * @param stream where to write the commands and responses
+ * @param suppressLogin if {@code true}, only print command name for login
+ *
+ * @since 3.0
+ */
+ public PrintCommandListener(PrintStream stream, boolean suppressLogin) {
+ this(new PrintWriter(stream), suppressLogin);
+ }
+
+ /**
+ * Create an instance which optionally suppresses login command text
+ * and indicates where the EOL starts with the specified character.
+ *
+ * @param stream where to write the commands and responses
+ * @param suppressLogin if {@code true}, only print command name for login
+ * @param eolMarker if non-zero, add a marker just before the EOL.
+ *
+ * @since 3.0
+ */
+ public PrintCommandListener(PrintStream stream, boolean suppressLogin,
char eolMarker) {
+ this(new PrintWriter(stream), suppressLogin, eolMarker);
+ }
+
+ /**
+ * Create the default instance which prints everything.
+ *
* @param writer where to write the commands and responses
*/
public PrintCommandListener(PrintWriter writer)