Beispiel #1
0
  public static byte[] toBlob(Persistable p) {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    OutputStream out = bos;

    try {
      p.writeExternal(new DataOutputStream(out));
      out.close();
    } catch (IOException e1) {
      e1.printStackTrace();
      throw new RuntimeException("Failed to serialize externalizable for content values");
    }
    return bos.toByteArray();
  }