code: @SuppressWarnings("unchecked")
    public static <S extends Serializable> S deserialize(InputStream inputStream) throws IOException {
      try {
        return (S) new ObjectInputStream(inputStream).readObject();
      } catch (ClassNotFoundException exception) {
        IOException ioe = new IOException("Failed to deserialize object");
        ioe.initCause(exception);
        throw ioe;
      } finally {
        inputStream.close();
      }
    }
docs: Deserializes the given input stream into to a newly allocated object, and close the input
  stream.
  
  @param inputStream input stream to deserialize
  @since 1.16