code: public static void writeReadDeleteDocument(DatabaseClient client, String filename, String format) throws IOException {
      // create a manager for documents of any format
      GenericDocumentManager docMgr = client.newDocumentManager();
  
      InputStream docStream = Util.openStream("data"+File.separator+filename);
      if (docStream == null)
        throw new IOException("Could not read document example");
  
      // create an identifier for the document
      String docId = "/example/"+filename;
  
      // create a handle for the document
      InputStreamHandle writeHandle = new InputStreamHandle();
      writeHandle.set(docStream);
  
      // write the document
      docMgr.write(docId, writeHandle);
  
      // create a handle to receive the document content
      BytesHandle readHandle = new BytesHandle();
  
      // read the document content
      docMgr.read(docId, readHandle);
  
      // access the document content
      byte[] document = readHandle.get();
  
      // ... do something with the document content ...
  
      // delete the document
      docMgr.delete(docId);
  
      System.out.println("Wrote, read, and deleted /example/"+filename+
        " content with "+document.length+" bytes in the "+format+" format");
    }
docs: write, read, and delete the document