KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quickserver > net > server > DataMode


1 /*
2  * This file is part of the QuickServer library
3  * Copyright (C) 2003-2005 QuickServer.org
4  *
5  * Use, modification, copying and distribution of this software is subject to
6  * the terms and conditions of the GNU Lesser General Public License.
7  * You should have received a copy of the GNU LGP License along with this
8  * library; if not, you can download a copy from <http://www.quickserver.org/>.
9  *
10  * For questions, suggestions, bug-reports, enhancement-requests etc.
11  * visit http://www.quickserver.org
12  *
13  */

14
15 package org.quickserver.net.server;
16 /**
17  * This class defines the mode(format) of data exchange between
18  * QuickServer and client socket.
19  * <p>
20  * Contributions By:
21  * Martin Benns : BYTE Mode
22  * </p>
23  * @since 1.2
24  * @author Akshathkumar Shetty
25  */

26 public class DataMode {
27     private String JavaDoc mode;
28     
29     private DataMode(String JavaDoc mode) {
30         this.mode = mode;
31     }
32     
33     public String JavaDoc toString() {
34         return mode;
35     }
36
37     /**
38      * String (default) data mode for {@link ClientHandler}
39      * - Receive data as String terminated by &lt;CR&gt;&lt;LF&gt
40      * When {@link ClientHandler} receives any String it calls
41      * {@link ClientCommandHandler#handleCommand} method
42      */

43     public static final DataMode STRING = new DataMode("String");
44     
45     /**
46      * Object data mode for {@link ClientHandler}
47      * - Receive java objects.
48      * When {@link ClientHandler} receives any Object it calls
49      * {@link ClientObjectHandler#handleObject} method.
50      */

51     public static final DataMode OBJECT = new DataMode("Object");
52     
53
54     /**
55      * Byte data mode for {@link ClientHandler}
56      * - Receive byte character data stream
57      * When {@link ClientHandler} receives any bytes it calls
58      * {@link ClientCommandHandler#handleCommand} method passing the
59      * character bytes received has a String object. This can be used to
60      * receive String data that are not terminated by &lt;CR&gt; and/or
61      * &lt;LF&gt or have &lt;CR&gt; and/or &lt;LF&gt in them.
62      */

63     public static final DataMode BYTE = new DataMode("Byte");
64
65     /**
66      * Binary data mode for {@link ClientHandler}
67      * - Receive binary data [byte]
68      * When {@link ClientHandler} receives any binary it calls
69      * {@link ClientBinaryHandler#handleBinary} method.
70      * @since 1.4
71      */

72     public static final DataMode BINARY = new DataMode("Binary");
73 }
74
Popular Tags