56 |
* created using the default no-argument constructor and the |
* created using the default no-argument constructor and the |
57 |
* <code>readExternal</code> method is used to restore the state. |
* <code>readExternal</code> method is used to restore the state. |
58 |
* |
* |
|
* @version 0.0 |
|
|
* |
|
59 |
* @author Aaron M. Renn (arenn@urbanophile.com) |
* @author Aaron M. Renn (arenn@urbanophile.com) |
60 |
*/ |
*/ |
61 |
public interface Externalizable extends Serializable |
public interface Externalizable extends Serializable |
62 |
{ |
{ |
63 |
static final long serialVersionUID = -282491828744381764L; |
static final long serialVersionUID = -282491828744381764L; |
64 |
|
|
65 |
/** |
/** |
66 |
* This method restores an object's state by reading in the instance data |
* This method restores an object's state by reading in the instance data |
67 |
* for the object from the passed in stream. Note that this stream is not |
* for the object from the passed in stream. Note that this stream is not |
68 |
* a subclass of <code>InputStream</code>, but rather is a class that implements |
* a subclass of <code>InputStream</code>, but rather is a class that |
69 |
* the <code>ObjectInput</code> interface. That interface provides a mechanism for |
* implements |
70 |
* reading in Java data types from a stream. |
* the <code>ObjectInput</code> interface. That interface provides a |
71 |
* <p> |
* mechanism for |
72 |
* Note that this method must be compatible with <code>writeExternal</code>. |
* reading in Java data types from a stream. |
73 |
* It must read back the exact same types that were written by that |
* <p> |
74 |
* method in the exact order they were written. |
* Note that this method must be compatible with <code>writeExternal</code>. |
75 |
* <p> |
* It must read back the exact same types that were written by that |
76 |
* If this method needs to read back an object instance, then the class |
* method in the exact order they were written. |
77 |
* for that object must be found and loaded. If that operation fails, |
* <p> |
78 |
* then this method throws a <code>ClassNotFoundException</code> |
* If this method needs to read back an object instance, then the class |
79 |
* |
* for that object must be found and loaded. If that operation fails, |
80 |
* @param in An <code>ObjectInput</code> instance for reading in the object state |
* then this method throws a <code>ClassNotFoundException</code> |
81 |
* |
* |
82 |
* @exception ClassNotFoundException If the class of an object being restored cannot be found |
* @param in An <code>ObjectInput</code> instance for reading in the object |
83 |
* @exception IOException If any other error occurs |
* state |
84 |
*/ |
* |
85 |
public abstract void |
* @exception ClassNotFoundException If the class of an object being |
86 |
readExternal(ObjectInput in) throws ClassNotFoundException, IOException; |
* restored cannot be found |
87 |
|
* @exception IOException If any other error occurs |
88 |
|
*/ |
89 |
|
public abstract void readExternal(ObjectInput in) |
90 |
|
throws ClassNotFoundException, IOException; |
91 |
|
|
92 |
/*************************************************************************/ |
/*************************************************************************/ |
93 |
|
|
94 |
/** |
/** |
95 |
* This method is responsible for writing the instance data of an object |
* This method is responsible for writing the instance data of an object |
96 |
* to the passed in stream. Note that this stream is not a subclass of |
* to the passed in stream. Note that this stream is not a subclass of |
97 |
* <code>OutputStream</code>, but rather is a class that implements the |
* <code>OutputStream</code>, but rather is a class that implements the |
98 |
* <code>ObjectOutput</code> interface. That interface provides a number of methods |
* <code>ObjectOutput</code> interface. That interface provides a |
99 |
* for writing Java data values to a stream. |
* number of methods |
100 |
* <p> |
* for writing Java data values to a stream. |
101 |
* Not that the implementation of this method must be coordinated with |
* <p> |
102 |
* the implementation of <code>readExternal</code>. |
* Not that the implementation of this method must be coordinated with |
103 |
* |
* the implementation of <code>readExternal</code>. |
104 |
* @param out An <code>ObjectOutput</code> instance for writing the object state |
* |
105 |
* |
* @param out An <code>ObjectOutput</code> instance for writing the |
106 |
* @exception IOException If an error occurs |
* object state |
107 |
*/ |
* |
108 |
public abstract void |
* @exception IOException If an error occurs |
109 |
writeExternal(ObjectOutput out) throws IOException; |
*/ |
110 |
|
public abstract void writeExternal(ObjectOutput out) throws IOException; |
111 |
|
|
112 |
} // interface Externalizable |
} // interface Externalizable |
113 |
|
|