Author: rwinston
Date: Sat Mar 8 12:34:02 2008
New Revision: 635074
URL: http://svn.apache.org/viewvc?rev=635074&view=rev
Log:
Move main method to example Javadoc block
Modified:
commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPServer.java
Modified:
commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPServer.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPServer.java?rev=635074&r1=635073&r2=635074&view=diff
==============================================================================
---
commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPServer.java
(original)
+++
commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPServer.java
Sat Mar 8 12:34:02 2008
@@ -25,7 +25,6 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.SocketTimeoutException;
@@ -50,6 +49,33 @@
* By default, logs debug info and errors to the console streams. This can be
changed with the
* setLog and setLogError methods.
*
+ * <p>
+ * Example usage is below:
+ *
+ * <code>
+ * public static void main(String[] args) throws Exception
+ * {
+ * if (args.length != 1)
+ * {
+ * System.out
+ * .println("You must provide 1 argument -
the base path for the server to serve from.");
+ * System.exit(1);
+ * }
+ *
+ * TFTPServer ts = new TFTPServer(new File(args[0]), new
File(args[0]), GET_AND_PUT);
+ * ts.setSocketTimeout(2000);
+ *
+ * System.out.println("TFTP Server running. Press enter to
stop.");
+ * new InputStreamReader(System.in).read();
+ *
+ * ts.shutdown();
+ * System.out.println("Server shut down.");
+ * System.exit(0);
+ * }
+ *
+ * </code>
+ *
+ *
* @author <A HREF="mailto:[EMAIL PROTECTED]">Dan Armbrust</A>
*/
@@ -77,26 +103,6 @@
private int maxTimeoutRetries_ = 3;
private int socketTimeout_;
-
- public static void main(String[] args) throws Exception
- {
- if (args.length != 1)
- {
- System.out
- .println("You must provide 1 argument -
the base path for the server to serve from.");
- System.exit(1);
- }
-
- TFTPServer ts = new TFTPServer(new File(args[0]), new
File(args[0]), GET_AND_PUT);
- ts.setSocketTimeout(2000);
-
- System.out.println("TFTP Server running. Press enter to
stop.");
- new InputStreamReader(System.in).read();
-
- ts.shutdown();
- System.out.println("Server shut down.");
- System.exit(0);
- }
/**
* Start a TFTP Server on the default port (69). Gets and Puts occur in
the specified