Debian Codegraph @

src/main/org/h2/api/JavaObjectSerializer.java

raw
1 /*
2 * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,
3 * and the EPL 1.0 (https://h2database.com/html/license.html).
4 * Initial Developer: H2 Group
5 */
6 package org.h2.api;
7
8 /**
9 * Custom serialization mechanism for java objects being stored in column of
10 * type OTHER.
11 *
12 * @author Sergi Vladykin
13 */
14 public interface JavaObjectSerializer {
15
16 /**
17 * Serialize object to byte array.
18 *
19 * @param obj the object to serialize
20 * @return the byte array of the serialized object
21 * @throws Exception on failure
22 */
23 byte[] serialize(Object obj) throws Exception;
24
25 /**
26 * Deserialize object from byte array.
27 *
28 * @param bytes the byte array of the serialized object
29 * @return the object
30 * @throws Exception on failure
31 */
32 Object deserialize(byte[] bytes) throws Exception;
33
34 }