- All Superinterfaces:
- Serializable
- All Known Subinterfaces:
- RemoteRef, ServerRef
- All Known Implementing Classes:
- DataFlavor, MLet, PrivateMLet
- See Also:
- Top Examples, Source Code,
ObjectOutputStream
,
ObjectInputStream
,
ObjectOutput
,
ObjectInput
void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1756]code for writeExternal
By Vijay Chaudhary on 2006/05/22 23:43:01 Rate
public int lowBid = 0;
public String highBid = "";
public void writeExternal ( ObjectOutput out ) throws IOException {
out.writeInt ( lowBid ) ;
out.writeObject ( highBid ) ;
}
[1757]code for writeExternal and readExternal
By Vijay Chaudhary on 2006/05/22 23:44:07 Rate
public int lowBid = 0;
public String highBid = "";
public void writeExternal ( ObjectOutput out ) throws IOException {
out.writeInt ( lowBid ) ;
out.writeObject ( highBid ) ;
}
public void readExternal ( ObjectInput in ) throws IOException, ClassNotFoundException {
lowBid = in.readInt ( ) ;
highBid = ( String ) in.readObject ( ) ;
}
[1937]serailizable
By prakashvenkat22 { at } gmail { dot } com on 2007/10/31 08:06:53 Rate
] code for writeExternal
By Vijay Chaudhary on 2006/05/22 23:43:01 Rate
public int lowBid = 0;
public String highBid = "";
public void writeExternal ( ObjectOutput out ) throws IOException {
out.writeInt ( lowBid ) ;
out.writeObject ( highBid ) ;
}
[ 1757 ] code for writeExternal and readExternal
By Vijay Chaudhary on 2006/05/22 23:44:07 Rate
public int lowBid = 0;
public String highBid = "";
public void writeExternal ( ObjectOutput out ) throws IOException {
out.writeInt ( lowBid ) ;
out.writeObject ( highBid ) ;
}
public void readExternal ( ObjectInput in ) throws IOException, ClassNotFoundException {
lowBid = in.readInt ( ) ;
highBid = ( String ) in.readObject ( ) ;
}
--------------------------------------------------------------------------------
void writeExternal ( ObjectOutput out )
throws IOExceptionGeek's Notes:
void writeExternal(ObjectOutput out)
throws IOException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1885]Guidelines for serialVersionUID
By Anonymous on 2007/05/30 09:48:48 Rate
Do not implement Serializable lightly, since it restricts future flexibility, and publicly exposes class implementation details which are usually private.
The serialVersionUID is a universal version identifier for a Serializable class. Deserialization uses this number to ensure that a loaded class corresponds exactly to a serialized object. If no match is found, then an InvalidClassException is thrown.
Guidelines for serialVersionUID :
* always include it as a field, for example: "private static final long serialVersionUID = 7526472295622776147L; " include this field even in the first version of the class, as a reminder of its importance
* do not change the value of this field in future versions, unless you are knowingly making changes to the class which will render it incompatible with old serialized objects
* new versions of Serializable classes may or may not be able to read old serialized objects; it depends upon the nature of the change; provide a pointer to Sun's guidelines for what constitutes a compatible change, as a convenience to future maintainers
* run serialver -show from the command line to generate the serialVersionUID
Explicitly versioning a class via serialVersionUID requires more code maintenance and is more error prone. There are many valid reasons for using serialVersionUID ( protecting against compiler differences, establishing backward serialization compatibility, etc. ) , but performance is not one of them.