[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ObjectInputStream and ObjectOutputStream problems(6)
From: |
Wu, Gansha |
Subject: |
ObjectInputStream and ObjectOutputStream problems(6) |
Date: |
Mon, 6 Aug 2001 09:57:06 +0800 |
I found setBlockDataMode() issues in both ObjectInputStream and
ObjectOutputStream
makes our serialized stream could hardly interoperate with JDK.
Java Object Serialization Spec demands "All primitive data written by
classes is buffered
and wrapped in block-data records", then the block I/O and direct I/O state
management
should be very important to ensure correctly read/write. IMHO, Classpath's use
two
DataInputStream to switch is a very clean and clever way, but Classpath's
implementation
of states switch is somewhat confusing. In ObjectInputStream.java, there're two
flags -
readDataFromBlock and isDeserializing - to control the state switch, that seems
messy.
And when setBlockDataMode() makes a state switch, what should do next must not
be a
switch back, but a switch to previous mode. But implementaion here has no place
for
previous mode, only isDeserializing has some related but limited meaning. I
think we
should review the code about this, I have a patch to make it work for JDK
serialization
stream to some extent, but it won't be helpful to clean the code.
BTW, I saw in Classpath's mail achieve there's a discussion about
"Serialization and
Sun" early in 1998, and no further discussion by now. When I read the source,
it seems
that Classpath is doing the work that makes serialization layout compatible
with Sun JDK.
I think it's reasonable when considering interoperable in some areas such as
RMI. How
about the decisions and progress?
Regards...
Gansha
- ObjectInputStream and ObjectOutputStream problems(6),
Wu, Gansha <=