KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > remoting > byvalue > ByValuePayload


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.test.remoting.byvalue;
8
9 import java.io.Externalizable JavaDoc;
10 import java.io.IOException JavaDoc;
11 import java.io.ObjectInput JavaDoc;
12 import java.io.ObjectOutput JavaDoc;
13
14 /**
15  * @author <a HREF="mailto:telrod@e2technologies.net">Tom Elrod</a>
16  */

17 public class ByValuePayload implements Externalizable JavaDoc
18 {
19    private boolean hasBeenMarshalled = false;
20
21
22    public boolean wasMarshalled()
23    {
24       return hasBeenMarshalled;
25    }
26
27
28    /**
29     * The object implements the readExternal method to restore its
30     * contents by calling the methods of DataInput for primitive
31     * types and readObject for objects, strings and arrays. The
32     * readExternal method must read the values in the same sequence
33     * and with the same types as were written by writeExternal.
34     *
35     * @param in the stream to read data from in order to restore the object
36     * @throws java.io.IOException if I/O errors occur
37     * @throws ClassNotFoundException If the class for an object being
38     * restored cannot be found.
39     */

40    public void readExternal(ObjectInput JavaDoc in) throws IOException JavaDoc, ClassNotFoundException JavaDoc
41    {
42       hasBeenMarshalled = true;
43    }
44
45    /**
46     * The object implements the writeExternal method to save its contents
47     * by calling the methods of DataOutput for its primitive values or
48     * calling the writeObject method of ObjectOutput for objects, strings,
49     * and arrays.
50     *
51     * @param out the stream to write the object to
52     * @throws java.io.IOException Includes any I/O exceptions that may occur
53     * @serialData Overriding methods should use this tag to describe
54     * the data layout of this Externalizable object.
55     * List the sequence of element types and, if possible,
56     * relate the element to a public/protected field and/or
57     * method of this Externalizable class.
58     */

59    public void writeExternal(ObjectOutput JavaDoc out) throws IOException JavaDoc
60    {
61       //NO OP - just care that readExternal is called on the deserialize
62
}
63 }
64
Popular Tags