shillelagh/src/main/java/shillelagh/internal/ShillelaghUtil.java
public static <K> K deserialize(byte[] bytes) {
    try {
      ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
      ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
      @SuppressWarnings("unchecked") final K k = (K) objectInputStream.readObject();
      return k;
    } catch (IOException e) {
      throw new RuntimeException(e);
    } catch (ClassNotFoundException e) {
      throw new RuntimeException(e);
    }
  }
public static <K> K deserialize(byte[] bytes) {
    try {
      ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
      ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
      @SuppressWarnings("unchecked") final K k = (K) objectInputStream.readObject();
      return k;
    } catch (IOException e) {
      throw new RuntimeException(e);
    } catch (ClassNotFoundException e) {
      throw new RuntimeException(e);
    }
  }
De-serialize a byte array back to it's original object.

@param bytes The bytes that where serialized from an object.
@param <K> The type the bytes should be serialised back too.
@return The de-serialized object.