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

Class Deserializer

Skay_Exp/src/tools/Deserializer.java:6–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4import java.util.concurrent.Callable;
5
6public class Deserializer implements Callable<Object> {
7 private final byte[] bytes;
8
9 public Deserializer(byte[] bytes) { this.bytes = bytes; }
10
11 public Object call() throws Exception {
12 return deserialize(bytes);
13 }
14
15 public static Object deserialize(final byte[] serialized) throws IOException, ClassNotFoundException {
16 final ByteArrayInputStream in = new ByteArrayInputStream(serialized);
17 return deserialize(in);
18 }
19
20 public static Object deserialize(final InputStream in) throws ClassNotFoundException, IOException {
21 final ObjectInputStream objIn = new ObjectInputStream(in);
22 return objIn.readObject();
23 }
24
25 public static void main(String[] args) throws ClassNotFoundException, IOException {
26 final InputStream in = args.length == 0 ? System.in : new FileInputStream(new File(args[0]));
27 Object object = deserialize(in);
28 }
29}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected