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 <<a href="mailto:firstname.lastname@example.org">email@example.com</a>>:</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>> I want to find out how many bytes my document is.<br>> An easy way would be to stream the document to disk, and then call<br>> File.size()<br>> but is there any way to find out without saving the document to disk
<br>> first??<br><br><br><br>_______________________________________________<br>To control your jdom-interest membership:<br><a href="http://firstname.lastname@example.org">http://email@example.com