code: public static <T> T readObject(Class<T> _class, InputStream inputStream) {
          try {
              return defaultObjectMapper.readValue(inputStream, _class);
          } catch (IOException exp) {
              throw new RuntimeException("Failed to read object from inputstream", exp);
          }
      }
docs: Careful! Not compatible with above method to convert objects to byte arrays!