Except with a profiler I don't expect this to be feasible.
paul
Kevin POCHAT wrote:
> There should be a way to count the bytes in a Java object without
> trying to output it, I mean, the object is in memory as bytes, so
> there must be a way to count them.
> Outputting the file somewhere may enable to know the EXACT size of the
> outputted file, but the object's size in memory should be accessible
> another way.
>
> Kevin.
>
> 2006/8/4, Paul Libbrecht <paul@(protected)
> <mailto:paul@(protected)>>:
>
> Print it to a stream that only counts but otherwise discards ?
> It's easy
> to write such a stream... just subclass outputstream.write(byte) and
> maybe .write(byte[],start,len) and count...
>
> I don't think there's a way without outputting.
>
> paul
>
> S?ren Faltz wrote:
> > I want to find out how many bytes my document is.
> > An easy way would be to stream the document to disk, and then call
> > File.size()
> > but is there any way to find out without saving the document to
> disk
> > first??
>

Attachment:
smime.p7s_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)