public void queryLobs(List<byte[]> ids) { for (Iterator<byte[]> it = ids.iterator(); it.hasNext(); ) { byte[] id = it.next(); String key = HexUtil.bytesToHex(id); if (DB4OStore.getIdentifiableObject(getObjectContainer(), key) == null) { it.remove(); } } }
public void loadLob(byte[] id, OutputStream out) throws IOException { String key = HexUtil.bytesToHex(id); IDB4OIdentifiableObject identifiableObject = DB4OStore.getIdentifiableObject(getObjectContainer(), key); if (identifiableObject == null) { throw new IOException("Lob not found: " + key); } if (identifiableObject instanceof DB4OBlob) { DB4OBlob blob = (DB4OBlob) identifiableObject; byte[] byteArray = blob.getValue(); ByteArrayInputStream in = new ByteArrayInputStream(byteArray); IOUtil.copyBinary(in, out, byteArray.length); } else { DB4OClob clob = (DB4OClob) identifiableObject; char[] charArray = clob.getValue(); CharArrayReader in = new CharArrayReader(charArray); IOUtil.copyCharacter(in, new OutputStreamWriter(out), charArray.length); } }