Package javax.jcr

Examples of javax.jcr.Binary


   * NOT use text).
   */
  public AssetItem updateBinaryContentAttachment(InputStream data) {
    checkout();
    try {
      Binary is = this.node.getSession().getValueFactory().createBinary(data);
      this.node.setProperty(CONTENT_PROPERTY_BINARY_NAME, is);
      return this;
    } catch (RepositoryException e) {
      log.error("Unable to update the assets binary content", e);
      throw new RulesRepositoryException(e);
View Full Code Here


    /** Wrapper around {@link #setProperty(String, Value)} */
    public Property setProperty(String name, InputStream value)
            throws RepositoryException {
        if (value != null) {
            Binary binary = getValueFactory().createBinary(value);
            try {
                return setProperty(name, getValueFactory().createValue(binary));
            } finally {
                binary.dispose();
            }
        } else {
            return setProperty(name, (Value) null);
        }
    }
View Full Code Here

     * mechanism to provide random access defined on {@link Binary}.
     *
     * @see QValue#getBinary()
     */
    public Binary getBinary() throws RepositoryException {
        return new Binary() {
            public InputStream getStream() throws RepositoryException {
                return AbstractQValue.this.getStream();
            }

            public int read(byte[] b, long position) throws IOException, RepositoryException {
View Full Code Here

     * NOT use text).
     */
    public PackageItem updateCompiledPackage(InputStream data) {
        checkout();
        try {
            Binary binary = this.node.getSession().getValueFactory().createBinary( data );
            this.node.setProperty( COMPILED_PACKAGE_PROPERTY_NAME,
                                   binary );
            this.node.setProperty( LAST_MODIFIED_PROPERTY_NAME,
                                   Calendar.getInstance() );
            return this;
View Full Code Here

    /** Wrapper around {@link #setProperty(String, Value)} */
    public Property setProperty(String name, InputStream value)
            throws RepositoryException {
        if (value != null) {
            Binary binary = getValueFactory().createBinary(value);
            try {
                return setProperty(name, getValueFactory().createValue(binary));
            } finally {
                binary.dispose();
            }
        } else {
            return setProperty(name, (Value) null);
        }
    }
View Full Code Here

    @Override @Nonnull
    public Property setProperty(String name, InputStream value)
            throws RepositoryException {
        if (value != null) {
            ValueFactory factory = getValueFactory();
            Binary binary = factory.createBinary(value);
            try {
                Value v = factory.createValue(binary);
                return internalSetProperty(name, v, false);
            } finally {
                binary.dispose();
            }
        } else {
            return internalRemoveProperty(name);
        }
    }
View Full Code Here

    @Test
    public void addBinaryProperty() throws RepositoryException, IOException {
        Node parentNode = getNode(TEST_PATH);
        InputStream is = new ByteArrayInputStream("foo\"".getBytes());
        Binary bin = getAdminSession().getValueFactory().createBinary(is);
        addProperty(parentNode, "binary", getAdminSession().getValueFactory().createValue(bin));
    }
View Full Code Here

    @Test
    public void addSmallBinaryProperty() throws RepositoryException, IOException {
        Node parentNode = getNode(TEST_PATH);
        InputStream is = new NumberStream(1234);
        Binary bin = getAdminSession().getValueFactory().createBinary(is);
        addProperty(parentNode, "bigBinary", getAdminSession().getValueFactory().createValue(bin));
    }
View Full Code Here

    @Test
    public void addBigBinaryProperty() throws RepositoryException, IOException {
        Node parentNode = getNode(TEST_PATH);
        InputStream is = new NumberStream(123456);
        Binary bin = getAdminSession().getValueFactory().createBinary(is);
        addProperty(parentNode, "bigBinary", getAdminSession().getValueFactory().createValue(bin));
    }
View Full Code Here

    public void addMultiValuedBinary() throws RepositoryException {
        Node parentNode = getNode(TEST_PATH);
        Value[] values = new Value[2];

        InputStream is = new ByteArrayInputStream("foo".getBytes());
        Binary bin = getAdminSession().getValueFactory().createBinary(is);
        values[0] = getAdminSession().getValueFactory().createValue(bin);

        is = new ByteArrayInputStream("bar".getBytes());
        bin = getAdminSession().getValueFactory().createBinary(is);
        values[1] = getAdminSession().getValueFactory().createValue(bin);
View Full Code Here

TOP

Related Classes of javax.jcr.Binary

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.