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. <br>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.
<br><br>Kevin.<br><br><div><span class="gmail_quote">2006/8/4, Paul Libbrecht &lt;<a href="mailto:paul@activemath.org">paul@activemath.org</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Print it to a stream that only counts but otherwise discards ? It's easy<br>to write such a stream... just subclass outputstream.write(byte) and<br>maybe .write(byte[],start,len) and count...<br><br>I don't think there's a way without outputting.
<br><br>paul<br><br>Søren Faltz wrote:<br>&gt; I want to find out how many bytes my document is.<br>&gt; An easy way would be to stream the document to disk, and then call<br>&gt; File.size()<br>&gt; but is there any way to find out without saving the document to disk
<br>&gt; first??<br><br><br><br>_______________________________________________<br>To control your jdom-interest membership:<br><a href="http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com">http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
</a><br><br><br></blockquote></div><br>