MCPcopy Create free account
hub / github.com/0linlin0/CyberBox / Serializer

Class Serializer

Skay_Exp/src/tools/Serializer.java:9–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7import java.util.concurrent.Callable;
8
9public class Serializer implements Callable<byte[]> {
10 private final Object object;
11 public Serializer(Object object) {
12 this.object = object;
13 }
14
15 public byte[] call() throws Exception {
16 return serialize(object);
17 }
18
19 public static byte[] serialize(final Object obj) throws IOException {
20 final ByteArrayOutputStream out = new ByteArrayOutputStream();
21 serialize(obj, out);
22 return out.toByteArray();
23 }
24
25 public static void serialize(final Object obj, final OutputStream out) throws IOException {
26 final ObjectOutputStream objOut = new ObjectOutputStream(out);
27 objOut.writeObject(obj);
28 }
29
30}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected