Example #1
0
 public void handleLobs(long fromTime, long toTime, CDOLobHandler handler) throws IOException {
   for (DB4OBlob db4oBlob : DB4OStore.getElementsOfType(getObjectContainer(), DB4OBlob.class)) {
     byte[] id = HexUtil.hexToBytes(db4oBlob.getId());
     byte[] blob = db4oBlob.getValue();
     ByteArrayInputStream in = new ByteArrayInputStream(blob);
     OutputStream out = handler.handleBlob(id, blob.length);
     if (out != null) {
       try {
         IOUtil.copyBinary(in, out, blob.length);
       } finally {
         IOUtil.close(out);
       }
     }
   }
   for (DB4OClob db4oClob : DB4OStore.getElementsOfType(getObjectContainer(), DB4OClob.class)) {
     byte[] id = HexUtil.hexToBytes(db4oClob.getId());
     char[] clob = db4oClob.getValue();
     CharArrayReader in = new CharArrayReader(clob);
     Writer out = handler.handleClob(id, clob.length);
     if (out != null) {
       try {
         IOUtil.copyCharacter(in, out, clob.length);
       } finally {
         IOUtil.close(out);
       }
     }
   }
 }