Package javax.jcr

Examples of javax.jcr.Binary.dispose()


            try {
                builder.append("<");
                builder.append(binary.getSize());
                builder.append(" bytes>");
            } finally {
                binary.dispose();
            }
        } else {
            String string = value.getString();
            if (string.length() > 40) {
                builder.append(string.substring(0, 37));
View Full Code Here


    public void testGetBinary() throws RepositoryException, IOException {
        Binary binary = prop.getBinary();
        byte[] bytes = new byte[(int) binary.getSize()];
        binary.read(bytes, 0);
        binary.dispose();

        assertEquals(prop.getString(), new String(bytes, "UTF-8"));
    }

    public void testGetBinaryFromValue() throws RepositoryException, IOException {
View Full Code Here

        Value v = superuser.getValueFactory().createValue("/a/b/c", PropertyType.PATH);
        Binary binary = v.getBinary();

        byte[] bytes = new byte[(int) binary.getSize()];
        binary.read(bytes, 0);
        binary.dispose();

        assertEquals(prop.getString(), new String(bytes, "UTF-8"));
    }

    public void testGetStream() throws RepositoryException, IOException {
View Full Code Here

                            dispose = true;
                            blob = getBLOBFileValue(store, b.getStream(), true);
                        }
                    } finally {
                        if (dispose) {
                            b.dispose();
                        }
                    }
                }
                return new InternalValue(blob);
            case PropertyType.BOOLEAN:
View Full Code Here

                Binary binary = session.getValueFactory().createBinary(
                        new ByteArrayInputStream(BINARY));
                try {
                    properties.setProperty("binary", binary);
                } finally {
                    binary.dispose();
                }
                properties.setProperty("date", DATE);
                properties.setProperty("decimal", new BigDecimal(123));
                properties.setProperty("double", Math.PI);
                properties.setProperty("long", 9876543210L);
View Full Code Here

                        assertEquals(-1, stream.read());
                    } finally {
                        stream.close();
                    }
                } finally {
                    binary.dispose();
                }
            } finally {
                session.logout();
            }
        } finally {
View Full Code Here

                        assertEquals(-1, stream.read());
                    } finally {
                        stream.close();
                    }
                } finally {
                    binary.dispose();
                }
                assertEquals(
                        PropertyType.DATE,
                        properties.getProperty("date").getType());
                assertEquals(
View Full Code Here

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

    /**
     * Returns a stream for reading the contents of the file stored at the
View Full Code Here

            final Binary binary = data.getBinary();
            return new FilterInputStream(binary.getStream()) {
                @Override
                public void close() throws IOException {
                    super.close();
                    binary.dispose();
                }
            };
        } else if (node.hasNode(Node.JCR_CONTENT)) {
            return readFile(node.getNode(Node.JCR_CONTENT));
        } else {
View Full Code Here

            try {
                builder.append("<");
                builder.append(binary.getSize());
                builder.append(" bytes>");
            } finally {
                binary.dispose();
            }
        } else {
            String string = value.getString();
            if (string.length() > 40) {
                builder.append(string.substring(0, 37));
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.