本文整理了Java中javax.jcr.Binary.dispose()
方法的一些代码示例,展示了Binary.dispose()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Binary.dispose()
方法的具体详情如下:
包路径:javax.jcr.Binary
类名称:Binary
方法名:dispose
[英]Releases all resources associated with this Binary
object and informs the repository that these resources may now be reclaimed. An application should call this method when it is finished with the Binary
object.
[中]释放与此Binary
对象关联的所有资源,并通知存储库这些资源现在可以回收。应用程序应在完成Binary
对象时调用此方法。
代码示例来源:origin: org.modeshape/modeshape-jdbc-local
@Override
public void free() {
binary.dispose();
}
代码示例来源:origin: org.onehippo.cms7/hippo-cms-api
@Override
public void dispose() {
binary.dispose();
}
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
@Override
public void close() throws IOException {
super.close();
binary.dispose();
}
};
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr-commons
@Override
public void close() throws IOException {
super.close();
binary.dispose();
}
};
代码示例来源:origin: apache/jackrabbit
@Override
public void close() throws IOException {
super.close();
binary.dispose();
}
};
代码示例来源:origin: apache/jackrabbit
@Override
public void close() throws IOException {
super.close();
binary.dispose();
}
};
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core
@Override
public void close() throws IOException {
super.close();
binary.dispose();
}
};
代码示例来源:origin: apache/jackrabbit
@Override
public void close() throws IOException {
super.close();
binary.dispose();
}
};
代码示例来源:origin: apache/jackrabbit-oak
private void addFile(Node parent, String fileName) throws RepositoryException {
Node file = getOrAddNode(parent, fileName, NodeType.NT_FILE);
Node content = getOrAddNode(file, Node.JCR_CONTENT, contentNodeType);
content.setProperty(Property.JCR_MIMETYPE, "text/plain");
content.setProperty(Property.JCR_LAST_MODIFIED, Calendar.getInstance());
Binary binary = parent.getSession().getValueFactory().createBinary(new ByteArrayInputStream("hello".getBytes()));
content.setProperty(Property.JCR_DATA, binary);
binary.dispose();
}
代码示例来源:origin: apache/jackrabbit
public void testBinaryLength() throws RepositoryException {
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());
}
代码示例来源:origin: apache/jackrabbit
public void testLengthBinaryLiteral() throws RepositoryException {
node.setProperty(propertyName1, "abc");
superuser.save();
String length = String.valueOf(node.getProperty(propertyName1).getLength());
Binary b = vf.createBinary(new ByteArrayInputStream(length.getBytes()));
try {
executeQueries(propertyName1, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
vf.createValue(b));
} finally {
b.dispose();
}
}
代码示例来源:origin: stackoverflow.com
String pdfUUID = "put-uuid-here";
Node pdfNode = session.getNodeByIdentifier(pdfUUID);
Node jcrContent = pdfNode.getNode("jcr:content");
Property dataProperty = jcrContent.getProperty("jcr:data");
Binary dataBinary = dataProperty.getBinary();
InputStream dataInputStream = dataBinary.getStream();
//do something
dataInputStream.close();
dataBinary.dispose();
代码示例来源:origin: apache/jackrabbit
protected Property setProperty(Node node, int length) throws RepositoryException {
Random rand = new Random();
byte[] data = new byte[length];
rand.nextBytes(data);
Binary b = vf.createBinary(new ByteArrayInputStream(data));
//System.out.println(b.getClass() + ": " + System.identityHashCode(b));
try {
return node.setProperty(propertyName1, b);
} finally {
b.dispose();
}
}
代码示例来源:origin: apache/jackrabbit
protected void checkBinary(Property p) throws Exception {
for (int i = 0; i < 3; i++) {
Binary bin = p.getBinary();
try {
//System.out.println(bin.getClass() + "@" + System.identityHashCode(bin));
bin.read(new byte[1], 0);
} finally {
bin.dispose();
}
}
}
}
代码示例来源:origin: apache/jackrabbit
protected void checkProperty(Property prop) throws Exception {
for (int i = 0; i < 3; i++) {
Binary b = prop.getBinary();
try {
//System.out.println(b.getClass() + ": " + System.identityHashCode(b));
b.read(new byte[1], 0);
} finally {
b.dispose();
}
}
}
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core
/** Wrapper around {@link #setValue(Value)} */
public void setValue(InputStream value) throws RepositoryException {
if (value != null) {
Binary binary = getValueFactory().createBinary(value);
try {
setValue(getValueFactory().createValue(binary));
} finally {
binary.dispose();
}
} else {
setValue((Value) null);
}
}
代码示例来源:origin: apache/jackrabbit
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"));
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core
/** 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);
}
}
代码示例来源:origin: apache/jackrabbit
/** Wrapper around {@link #setValue(Value)} */
public void setValue(InputStream value) throws RepositoryException {
if (value != null) {
Binary binary = getValueFactory().createBinary(value);
try {
setValue(getValueFactory().createValue(binary));
} finally {
binary.dispose();
}
} else {
setValue((Value) null);
}
}
代码示例来源:origin: apache/jackrabbit
public void testGetBinaryFromValue() throws RepositoryException, IOException {
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"));
}
内容来源于网络,如有侵权,请联系作者删除!