Package javax.jcr

Examples of javax.jcr.Binary.dispose()


                assertEquals("unexpected result of Value.getBinary.read()", content[content.length - 1], buf[0]);
                assertTrue("unexpected result of Value.getBinary.read()", -1 != bin.read(buf, 0));
                assertEquals("unexpected result of Value.getBinary.read()", content[0], buf[0]);
            }
        } finally {
            bin.dispose();
        }
    }
   
}
View Full Code Here


                        in2.close();
                    } catch (IOException ignore) {}
                }
            }
        } finally {
            bin.dispose();
        }
    }

    /**
     * Tests the failure of calling Property.getStream() on a multivalue
View Full Code Here

                try {
                    in2.close();
                } catch (IOException ignore) {}
            }
        } finally {
            bin.dispose();
        }
    }

    /**
     * Tests conversion from Binary type to Boolean type. This is done via
View Full Code Here

        Binary binary = val.getBinary();
        long length;
        try {
            length = binary.getSize();
        } finally {
            binary.dispose();
        }
        long bytes = PropertyUtil.countBytes(prop.getValue());
        if (bytes != -1) {
            assertEquals("Binary.getSize() returns wrong number of bytes.",
                    bytes, length);
View Full Code Here

        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

            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

        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

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

            fileNode.getSession().save();
            JcrNode jcrFileNode = create(fileNode);
            if (versioningState == VersioningState.NONE) {
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.