Probably because implementing Writable
would present us with a serializable object. I know DataInput
and DataOutput
directly deal with byte streams but I see no harm in directly reading values off them and storing it in primitive types too.
That being said, the very use of readFields()
and write()
methods seems futile and only could be used with the perspective of modularity. Creating objects for DataInput
and DataOutput
classes for instance variables and directly taking inputs (using DataInput
and DataOutput
like a Scanner utility class) seems quite simple. Creating an interface for them and implementing those obvious methods (be it in pre-defined box classes or our own custom classes) look like syntactic sugar as far as I can see.
Help me see through it if there's something to be seen.
UPDATE: DataInput
and DataOutput
classes produce serialized objects! :o