Package javax.jcr

Examples of javax.jcr.Binary.dispose()


        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


        byte[] data = "abc".getBytes();
        Binary b = vf.createBinary(new ByteArrayInputStream(data));
        try {
            node.setProperty(propertyName1, b);
        } finally {
            b.dispose();
        }
        superuser.save();
        checkOperators(propertyName1, node.getProperty(propertyName1).getLength());
    }
View Full Code Here

        Binary b = vf.createBinary(new ByteArrayInputStream(length.getBytes()));
        try {
            executeQueries(propertyName1, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
                    vf.createValue(b));
        } finally {
            b.dispose();
        }
    }

    public void testLengthDoubleLiteral() throws RepositoryException {
        node.setProperty(propertyName1, "abc");
View Full Code Here

        assertTrue("ValueFactory.createValue(InputStream) is expected to close the passed input stream", in.isClosed());

        in = new InputStreamWrapper(new ByteArrayInputStream(binaryValue));
        Binary bin = valueFactory.createBinary(in);
        assertTrue("ValueFactory.createBinary(InputStream) is expected to close the passed input stream", in.isClosed());
        bin.dispose();
    }
}
View Full Code Here

        // make sure binary is disposed after stream had been consumed
        return new AutoCloseInputStream(binary.getStream()) {
            @Override
            public void close() throws IOException {
                super.close();
                binary.dispose();
            }
        };
    }

    /** Wrapper around {@link #getValue()} */
 
View Full Code Here

        if (value != null) {
            Binary binary = getValueFactory().createBinary(value);
            try {
                setValue(getValueFactory().createValue(binary));
            } finally {
                binary.dispose();
            }
        } else {
            setValue((Value) null);
        }
    }
View Full Code Here

                    IOUtil.spool(in, out);
                } finally {
                    in.close();
                }
            } finally {
                binary.dispose();
            }
        } catch (RepositoryException e) {
            log.error("Cannot obtain stream from " + item, e);
        }
    }
View Full Code Here

                if (contentStream != null && contentStream.getMimeType() != null) {
                    contentNode.setProperty(Property.JCR_MIMETYPE, contentStream.getMimeType());
                }
            }
            finally {
                binary.dispose();
            }

            contentNode.getSession().save();

            if (autoCheckout) {
View Full Code Here

            Binary b = prop.getBinary();
            try {
                //System.out.println(b.getClass() + ": " + System.identityHashCode(b));
                b.read(new byte[1], 0);
            } finally {
                b.dispose();
            }
        }
    }
}
View Full Code Here

            content.setProperty(Property.JCR_LAST_MODIFIED, date);
            content.setProperty(Property.JCR_DATA, binary);
            return file;
        } finally {
            binary.dispose();
        }
    }

    /**
     * Returns a string representation of the given item. The returned string
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.