<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=587371014-04082006><FONT face=Arial
color=#0000ff size=2>Saying "should" and "must" doesn't make it true. I don't
know why Java doesn't provide this capability, but it
doesn't.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=587371014-04082006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=587371014-04082006><FONT face=Arial
color=#0000ff size=2>In any case, you (the OP) don't want the number of bytes in
the document object, you want the number of bytes in all the objects in the
tree. Perhaps. Other people thought you wanted the number of bytes in its
serialization. I don't think we actually know what the requirement is, perhaps
someone will tell us.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=587371014-04082006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=587371014-04082006><FONT face=Arial
color=#0000ff size=2>Micahel Kay</FONT></SPAN></DIV>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV></DIV>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:paul@activemath.org">paul@activemath.org</A>>:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">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://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></BLOCKQUOTE></BODY></HTML>