code: public static <T> T getEntity(InputStream in, Class<T> clazz) {
          if (clazz == InputStream.class) {
              //noinspection unchecked
              return (T) clazz;
          }
  
          try {
              return JsonHelper.readJson(in, clazz);
          } catch (IOException e) {
              throw Throwables.propagate(e);
          }
      }
docs: Reads the entity input stream and deserializes the JSON content to the given class.