public static Object byteToObject(byte[] bytes, SiddhiAppContext siddhiAppContext) {
        long start = System.currentTimeMillis();
        Object out = null;
        if (bytes != null) {
            try {
                ByteArrayInputStream bios = new ByteArrayInputStream(bytes);
                ObjectInputStream ois = new ObjectInputStream(bios);
                out = ois.readObject();
            } catch (IOException e) {
                log.error(ExceptionUtil.getMessageWithContext(e, siddhiAppContext) +
                        " Error when writing to object.", e);
                return null;
            } catch (ClassNotFoundException e) {
                log.error(ExceptionUtil.getMessageWithContext(e, siddhiAppContext) +
                        " Error when writing to object.", e);
                return null;
            }
        }
        long end = System.currentTimeMillis();
        if (log.isDebugEnabled()) {
            log.debug("SiddhiApp '" + siddhiAppContext.getName() + "' decoded in: " + (end - start) + " milliseconds");
        }
        return out;
    }
Serializer used by {@link SnapshotService} to do Object to Byte[] conversion and vise-versa
modules/siddhi-core/src/main/java/io/siddhi/core/util/snapshot/ByteSerializer.java