Ejemplo n.º 1
0
 /**
  * Read {@link DataMap} from InputStream.
  *
  * @param stream input stream
  * @return {@link DataMap}
  */
 public static DataMap readMap(final InputStream stream) {
   try {
     return CODEC.readMap(stream);
   } catch (IOException e) {
     throw new RestLiInternalException(e);
   }
 }
Ejemplo n.º 2
0
 /**
  * A combination of {@link #readMap(java.io.InputStream)} and {@link
  * #convert(com.linkedin.data.DataMap, Class)} for collection responses.
  *
  * @param stream input stream
  * @param recordClass class of the requested type
  * @param <T> requested object type
  * @return a new object of the requested type constructed with DataMap read from input stream
  */
 public static <T extends RecordTemplate> CollectionResponse<T> readCollectionResponse(
     final InputStream stream, final Class<T> recordClass) {
   try {
     DataMap dataMap = CODEC.readMap(stream);
     return new CollectionResponse<T>(dataMap, recordClass);
   } catch (IOException e) {
     throw new RestLiInternalException(e);
   }
 }
Ejemplo n.º 3
0
 /**
  * Effectively a combination of {@link #readMap(InputStream)} and {@link #convert(DataMap,
  * Class)}.
  *
  * @param stream input stream
  * @param recordClass class of the requested type
  * @param <T> requested object type
  * @return a new object of the requested type constructed with DataMap read from input stream
  * @throws IOException on error reading input stream
  */
 public static <T extends RecordTemplate> T read(
     final InputStream stream, final Class<T> recordClass) throws IOException {
   try {
     DataMap dataMap = CODEC.readMap(stream);
     return DataTemplateUtil.wrap(dataMap, recordClass);
   } catch (IllegalArgumentException e) {
     throw new RestLiInternalException(e);
   } catch (SecurityException e) {
     throw new RestLiInternalException(e);
   }
 }