ObjectOutputStream is totally inefficient when writing just a small amount of data. It creates a lot of garbage (2 or
3 KB to just a create it) plus it also writes all the header/block header into the stream.
In the server when we serialize the ManagedObjects to sleepycat, we really dont need all the fancy things and we cant
afford to create such overhead. This class is an attempt to solve these problems without getting too complicated.
The writeObject() method in this class can only handle writing Literal Objects and will throw an AssertionError for
any other kind of object.
TCObjectInputStream compliments this class. Since TCDataOutput doesnt throw IOException and DataOutputStream has all
final methods, I have to reimplement DataOutputStream to not throw IOException.
|