code: private static Optional<Object> deserialize(InputStream input) throws IOException {
          try {
              BufferedInputStream bis = new BufferedInputStream(input);
              ObjectInputStream ois = new ObjectInputStream(bis);
  
              return Optional.of(ois.readObject());
          } catch (ClassNotFoundException ex) {
              LOG.log(Level.SEVERE, "An error occurred during deserialization an object.", ex);
          }
          return Optional.empty();
      }
docs: Deserializes an {@code Optional<Object>} from the given stream.
  
  The given stream will not be close.
  
  @param input the serialized object input stream, must not be null
  @return the serialized object
  @throws IOException in case the load operation failed