In JCR 1 you can do:
final InputStream in = zip.getInputStream(zip.getEntry(zipEntryName)); node.setProperty(JcrConstants.JCR_CONTENT, in);
But this is deprecated in JCR 2, as described in http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/Node.html#setProperty%28java.lang.String,%20java.io .InputStream% 29
This says that I should use node.setProperty(String, Binary) , but I see no way to turn my input stream into a binary file. Can someone point me to a document or sample code for this?
node.setProperty(String, Binary)
ValueFactory.createBinary(InputStream stream)
You get ValueFactory through the session returned by Repository.login ()
Just a hint after Rob's answer, if you are wondering where to get the ValueFactory , you can use:
ValueFactory
node.getSession().getValueFactory().createBinary(inputStream)
Source: https://habr.com/ru/post/1305881/More articles:Configuring UITabBar - objective-cAndroid: create a TextView that will flash when clicked - androidhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1305878/best-ways-to-construct-dynamic-search-conditions-for-sql&usg=ALkJrhgZopO5dpWan2ngb6AprknXnvi5xQCreating urls when not using integer as identifier? - ruby-on-railsFaster calculated values โโ(quadratic form, metric matrix ...) - performanceSave images in SQL or not? - sqlHow to remove [sub] hash based on keys / values โโof another hash? - perlHow to store and access JSON data for a site? - jsonAdjust WPF RichTextBox width and height according to the size of a monospace font - c #How to implement mib module in net-snmp using python? - pythonAll Articles