KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > exchange > PacketBody


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2006 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.exchange;
14
15 import java.io.InputStream JavaDoc;
16 import java.util.Calendar JavaDoc;
17
18
19 /**
20  * @author Sameer Charles
21  */

22 public interface PacketBody {
23
24     /**
25      * <p>
26      * set packet type, supported types
27      * <ul>
28      * <li><code>PacketType.STRING</code>
29      * <li><code>PacketType.BINARY</code>
30      * <li><code>PacketType.LONG</code>
31      * <li><code>PacketType.DOUBLE</code>
32      * <li><code>PacketType.DATE</code>
33      * <li><code>PacketType.BOOLEAN</code>
34      * </ul>
35      * </p>
36      * @param type
37      */

38     void setType(int type);
39
40     /**
41      * <p>
42      * one of these packet types
43      * <ul>
44      * <li><code>PacketType.STRING</code>
45      * <li><code>PacketType.BINARY</code>
46      * <li><code>PacketType.LONG</code>
47      * <li><code>PacketType.DOUBLE</code>
48      * <li><code>PacketType.DATE</code>
49      * <li><code>PacketType.BOOLEAN</code>
50      * </ul>
51      * </p>
52      */

53     int getType();
54
55     /**
56      * @param size
57      */

58     void setLength(long size);
59
60     /**
61      * @return lenth of the packet body
62      */

63     long getLength();
64
65     /**
66      * <p>
67      * set packet body, Packet type also must be set here
68      * </p>
69      * @param data
70      */

71     void setBody(String JavaDoc data) throws PacketIOException;
72
73     /**
74      * <p>
75      * set packet body, Packet type must be set here
76      * </p>
77      * @param data
78      */

79     void setBody(InputStream JavaDoc data) throws PacketIOException;
80
81     /**
82      * <p>
83      * set packet body, Packet type must be set here
84      * </p>
85      * @param data
86      */

87     void setBody(Long JavaDoc data) throws PacketIOException;
88
89     /**
90      * <p>
91      * set packet body, Packet type must be set here
92      * </p>
93      * @param data
94      */

95     void setBody(Double JavaDoc data) throws PacketIOException;
96
97     /**
98      * <p>
99      * set packet body, Packet type must be set here
100      * </p>
101      * @param data
102      */

103     void setBody(Calendar JavaDoc data) throws PacketIOException;
104
105     /**
106      * <p>
107      * set packet body, Packet type must be set here
108      * </p>
109      * @param data
110      */

111     void setBody(Boolean JavaDoc data) throws PacketIOException;
112
113     /**
114      * <p>
115      * set packet body, Packet type must be set here
116      * </p>
117      * @param data
118      */

119     void setBody(Object JavaDoc data) throws PacketIOException;
120
121     /**
122      * <p>
123      * returns string representation of the data set by any data type
124      * </p>
125      */

126     String JavaDoc toString();
127
128     /**
129      * <p>
130      * gets data as object
131      * </p>
132      */

133     Object JavaDoc getObject();
134 }
135
Popular Tags