jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: How to store randomly accessed data in jackrabbit?
Date Fri, 26 Feb 2010 17:21:25 GMT
On Fri, Feb 26, 2010 at 15:40, Illarion Kovalchuk
<illarion.kovalchuk@gmail.com> 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
alexander.klimetschek@day.com

Mime
View raw message