Hi Alexander,
make some property like "size" and set it while writing the file
content into the database, or are there any better solutions?
We are doing that and it works well for us. In our application this is being
done "on the way" while reading the binary data and doing some other stuff.
And yep, then you just add another property "size" and store that value in
it, e.g. by extending the nt:file or nt:resource node types.
We have also done it once by using the java.io.InputStream.available()
method, e.g.
int size = myNode.getProperty("streamProperty").getStream().available();
Well, that also works for us in one particular case, but I am not sure in
which cases it fails, since available() isn't really intended to return the
total size of the Stream, as far as I understand it. See
http://java.sun.com/j2se/1.4.2/docs/api/java/io/InputStream.html#available()
.
Regards
Hendrik
-- www.jcr-explorer.org --
-----Original Message-----
From: Alexander Nesterov [mailto:alex...@gmail.com]
Sent: Tuesday, October 02, 2007 1:12 AM
To: use...@jackrabbit.apache.org
Subject: Getting the size of binary node content
Hello,
I have a question regarding getting the size of binary node content.
There are binary nodes in which the content of files is stored. What's
the best way to get the size of initial file? I don't want to
calculate the size by reading the whole node's content. Do I have to
make some property like "size" and set it while writing the file
content into the database, or are there any better solutions?