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