MCPcopy Create free account
hub / github.com/Y4er/ysoserial / Serializer

Class Serializer

src/main/java/ysoserial/Serializer.java:9–31  ·  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
12 public Serializer(Object object) {
13 this.object = object;
14 }
15
16 public static byte[] serialize(final Object obj) throws IOException {
17 final ByteArrayOutputStream out = new ByteArrayOutputStream();
18 serialize(obj, out);
19 return out.toByteArray();
20 }
21
22 public static void serialize(final Object obj, final OutputStream out) throws IOException {
23 final ObjectOutputStream objOut = new ObjectOutputStream(out);
24 objOut.writeObject(obj);
25 }
26
27 public byte[] call() throws Exception {
28 return serialize(object);
29 }
30
31}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected