For this you use ValueFactory

Example
node.setProperty(JcrConstants.JCR_DATA,node.getSession().getValueFactory().createBinary
 
<https://www.tabnine.com/code/java/methods/javax.jcr.ValueFactory/createBinary>(new
 FileInputStream(“/tmp/test.jpg)));


— 
Jakub Kaniewski | 666 831 500 | jakub.kaniew...@gmail.com




> On 26 Aug 2021, at 00:59, Brian E. Lavender <br...@brie.com> wrote:
> 
> How is it I add a binary to a Node?
> 
> I see the following method.
> Property setProperty(java.lang.String name, Binary value)
> 
> I see that Binary is an interface, yet I am not sure how to create a
> Binary from a File that I open. 
> 
> Or, stated another way, say I want to add a jpg image from my disk to
> a node. Would I use this setProperty method? How would I do it?
> 
> Brian
> -- 
> Brian Lavender
> http://www.brie.com/brian/
> 
> "There are two ways of constructing a software design. One way is to
> make it so simple that there are obviously no deficiencies. And the other
> way is to make it so complicated that there are no obvious deficiencies."
> 
> Professor C. A. R. Hoare
> The 1980 Turing award lecture

Reply via email to