Re: Buffers not Serializable in Java?

bob wrote:
Why are Buffers not Serializable in Java?
(One presumes to assume that you refer here to 'java.nio.Buffer'.)

Why should they be?

What would a serialized 'Buffer' mean, exactly?

A 'Buffer' is a holder for serialized data already, is it not?

It's sort of like serializing a Reader or a Writer. It boils down to what one considers state for the type.

Anyway, 'Buffer' is intended as a staging area between things, a conduit for serialization. You would simply transmit the contents of the 'Buffer'.

Now one gives you the benefit of the doubt that you really want to serialize one of the subtypes of 'Buffer', since you can't instantiate an abstract class.

Near as I can tell, you can quite readily serialize the 'array()' results given back by these subtypes are all serializable, so you're only one method call away.

Now, please answer in return, why in the world do you want to serialize a 'Buffer'?