| 4 | import java.util.concurrent.Callable; |
| 5 | |
| 6 | public 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected