On Fri, Feb 26, 2010 at 15:40, Illarion Kovalchuk
<[email protected]> wrote:
> My task is to determine the proper JCR repository structure for storing of
> binary data, so that I'll be able to:
>
> 1) Read data starting from any offset
> 2) Write/Modify data starting from any offset
>
> It seems that binary properties can't be used in such way, so I need to
> implement some logic on top of jcr... Could you help?
Yes, binary properties can only be read as a whole (InputStream
returned is read-only) and stored back as a whole (new input stream).
I think the way to go is to copy the existing binary value (note: pseudo-code)
node.getProperty("jcr:data").getBinary().getInputStream()
into either a local file or an in-memory input stream, do your work
there and then finally store the whole stream again
node.setProperty("jcr:data", valueFactory.createBinary(stream))
Regards,
Alex
--
Alexander Klimetschek
[email protected]