> I just subscribed to this list, so, for all I know, this may already have
> been taken care of, but....
>
> I just finished a java.util.Hashtable (JDK1.2 compliant) implementation, and
> am offering it up, if it is wanted. Where should I send it?
Great! One less thing in the Util package to deal with.
> Oh -- I don't quite understand the "Serialized Form" for Hashtable, so it
> isn't yet binary compatible with the JDK. It's also at present wholly
> undocumented. I'm perfectly willing to complete both tasks, but someone is
> going to have to explain the finer points of the former to me.
I think I can help you out here. The Serialized Form gives you a
description of what fields get serialized when the Object is serialized.
There can be no additional fields in the Object than those listed in
Serialized Form to be binary compatible (Unless the field is transient).
In Hashtable's case, the Serialized Form asks that you implement a
readObject and writeObject method. Essentially, you have to serialize the
Hashtable yourself. You'll want to use the methods of the
ObjectOutputStream to components of the Hashtable over the stream. It
asks that you send the capacity (as an int), then the size (also an int I
believe), then use ObjectOutputStreams writeObject for each key-value
pair. So roughly:
s.writeInt(capacity);
s.writeInt(size);
for (int i=0; i<size; i++) {
s.writeObject(keyAt(i));
s.writeObject(valueAt(i));
}
For the readObject, reverse the process.
Somebody smack me if I'm wrong.
Scott
--------------------------------------------------------------------------
Java Programmer Scott Gregory Miller Linux afficionado
Graphics Designer [EMAIL PROTECTED] General Loony
--------------------------------------------------------------------------