code: public boolean takeSnapshot(OutputStream out) throws IOException {
      TransactionSnapshot snapshot = getSnapshot();
      if (snapshot != null) {
        persistor.writeSnapshot(out, snapshot);
        return true;
      } else {
        return false;
      }
    }
docs: Take a snapshot of the transaction state and serialize it into the given output stream.
  @return whether a snapshot was taken.