Hi Paco, > In our application (OpenKM - Document Management System) we store file > size in a node property. I think it is faster than getting the document > content size every time.
I agree, especially for Document Management System like OpenKM. The reason behind using InputStream.available() for this one case was that the size of every jcr:data property of nt:resource nodes should be shown *generically*, i.e. without adding properties or further customizing of node types. In that case we didn't see anything else than a) getting the size every time or b) using InputStream.available(). And: in that case it didn't really matter if it works in 100% of the cases. It was more that it was good to have it, but it's also not a problem if it fails it some cases, e.g. concurrent access of the same Stream by different users (which might such a case where it fails). BR Hendrik > -----Original Message----- > From: Paco Avila [mailto:[EMAIL PROTECTED] > Sent: Tuesday, October 02, 2007 4:41 PM > To: [email protected] > Subject: RE: Getting the size of binary node content > > El mar, 02-10-2007 a las 02:51 +0700, Hendrik Beck (camunda) escribió: > > 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(); > > In our application (OpenKM - Document Management System) we store file > size in a node property. I think it is faster than getting the document > content size every time. > > -- > GIT CONSULTORS > > www.git.es > > Tel: +34 971 498 310 > Fax: +34 971 496 189 > > C/ Francesc Rover, 2B. > 07003 Palma de Mallorca Illes Balears (España) >
