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'?

--
Lew

.



Relevant Pages

  • Re: Serialization optimization
    ... private IntPtr buffer; ... The buffer field is allocated from an unmanaged memory (via a COM ... If you're remoting in the same process (that is, ... For .GetObjectData, it's of little to no use because you can't serialize individual bytes and you can't really use a more efficient representation than a byte array either ...
    (microsoft.public.dotnet.general)
  • Re: Binat Serialization With Headers
    ... might be bigger than the receive buffer. ... the Header array needs to be created before you serialize the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Linux kernel file offset pointer races
    ... ...serialize all operations modifying a shared file pointer wrt operations ... write(fd, buffer, 1000000); ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Of Structs, Layouts, and Serialization
    ... serialize a class, and if you need something smaller you will have to ... that generates a buffer that's much larger ... than the actual size of the members in the class. ... Not if you use the BinaryFormatter. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Of Structs, Layouts, and Serialization
    ... When you serialize a class using Serializable in .NET I believe it ... every time the class's members change, and I think there's probably a ... serialize the object to a memory stream, ... that generates a buffer that's much larger ...
    (microsoft.public.dotnet.languages.csharp)