Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #9122 > unrolled thread

Buffers not Serializable in Java?

Started bybob <bob@coolgroups.com>
First post2011-10-23 11:11 -0700
Last post2011-10-23 21:02 -0700
Articles 4 — 4 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Buffers not Serializable in Java? bob <bob@coolgroups.com> - 2011-10-23 11:11 -0700
    Re: Buffers not Serializable in Java? Lew <lewbloch@gmail.com> - 2011-10-23 16:01 -0700
    Re: Buffers not Serializable in Java? dagon@dagon.net (Dagon) - 2011-10-23 13:16 -0700
    Re: Buffers not Serializable in Java? Roedy Green <see_website@mindprod.com.invalid> - 2011-10-23 21:02 -0700

#9122 — Buffers not Serializable in Java?

Frombob <bob@coolgroups.com>
Date2011-10-23 11:11 -0700
SubjectBuffers not Serializable in Java?
Message-ID<a12ae79e-0c35-41b4-ae36-6f9a84cc588b@q13g2000vbd.googlegroups.com>
Why are Buffers not Serializable in Java?

[toc] | [next] | [standalone]


#9124

FromLew <lewbloch@gmail.com>
Date2011-10-23 16:01 -0700
Message-ID<4227919.669.1319410915805.JavaMail.geo-discussion-forums@yqgd7>
In reply to#9122
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

[toc] | [prev] | [next] | [standalone]


#9125

Fromdagon@dagon.net (Dagon)
Date2011-10-23 13:16 -0700
Message-ID<b99en8-8dd.ln1@dagon.net>
In reply to#9122
In article <a12ae79e-0c35-41b4-ae36-6f9a84cc588b@q13g2000vbd.googlegroups.com>,
bob  <bob@coolgroups.com> wrote:
>Why are Buffers not Serializable in Java?

Wild guess:

Buffers are often used for managing resources outside the Java language, and
it would add a lot of complexity to force all implementations to be able to
freeze and restore their state.

Nothing stops you from writing a subclass that is Serializable.
--
Mark Rafn    dagon@dagon.net    <http://www.dagon.net/>  

[toc] | [prev] | [next] | [standalone]


#9134

FromRoedy Green <see_website@mindprod.com.invalid>
Date2011-10-23 21:02 -0700
Message-ID<1oo9a7t21fbg5g3vja27a34gvg6oba9cpc@4ax.com>
In reply to#9122
On Sun, 23 Oct 2011 11:11:34 -0700 (PDT), bob <bob@coolgroups.com>
wrote, quoted or indirectly quoted someone who said :

>Why are Buffers not Serializable in Java?

Are not buffers usually associated with a file?  How could the frozen
Buffer capture enough so that if it were thawed in some other computer
it would behave anything like the original?
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
It should not be considered an error when the user starts something
already started or stops something already stopped. This applies
to browsers, services, editors... It is inexcusable to 
punish the user by requiring some elaborate sequence to atone,
e.g. open the task editor, find and kill some processes.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web