From: Kevin McMurtrie on
In article <vhzUn.41045$_F1.14580(a)hurricane>,
"Boris Punk" <khgfhf(a)hmjggg.com> wrote:

> Is there anyway to do this? Serialization looks cumbersome and I want to
> dump the data of an object onto disk.
>
> eg.
>
> class AClass{
> AClass(){
> }
> }
>
> how do you get a representation of this in byte form? It can't be that
> difficult to grab from memory, dump to disk, then retrieve back into memory
> again?
>
> Thanks

sun.misc.Unsafe will do it. I'm sure you'll find that it's a very aptly
named class. It's like the old peek() and poke() but decades after
fixed memory addresses when out of style.

I second the recommendation for serialization using ObjectOutputStream
and ObjectInputStream. You can write your own readObject and
writeObject methods when you find that the default serialization isn't
efficient.
--
I won't see Google Groups replies because I must filter them as spam