(Object obj)
| 525 | } |
| 526 | |
| 527 | public static byte[] javaSerialize(Object obj) { |
| 528 | try { |
| 529 | ByteArrayOutputStream bos = new ByteArrayOutputStream(); |
| 530 | ObjectOutputStream oos = new ObjectOutputStream(bos); |
| 531 | oos.writeObject(obj); |
| 532 | oos.close(); |
| 533 | return bos.toByteArray(); |
| 534 | } catch (IOException e) { |
| 535 | throw new RuntimeException(e); |
| 536 | } |
| 537 | } |
| 538 | |
| 539 | public static <T> T javaDeserialize(byte[] serialized, Class<T> clazz) { |
| 540 | if ("true".equalsIgnoreCase(System.getProperty("java.deserialization.disabled"))) { |