[jdom-interest] How many bytes is my JDOM Document
Søren Faltz
soren.faltz at gmail.com
Tue Aug 8 03:09:15 PDT 2006
I am determing the size this way
String s;
int contentLength=0;
try {
s = convertDocumentToString(doc);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutputStream objOut = new ObjectOutputStream(bout);
objOut.writeObject(s);
contentLength = bout.size();
objOut.flush();
bout.flush();
2006/8/4, Paul Libbrecht <paul at activemath.org>:
>
> 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??
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20060808/ace40a72/attachment.htm
More information about the jdom-interest
mailing list