@ Override public Object readFrom ( Class < Object > type , Type genericType , Annotation [ ] annotations , MediaType mediaType , MultivaluedMap < String , String > httpHeaders , InputStream inputStream ) throws IOException , WebApplicationException { String json = null ; Object result = null ; InputStreamReader inputStreamReader = null ; try { inputStreamReader = new InputStreamReader ( inputStream , CHARSET ) ; Type jsonType = getAppropriateType ( type , genericType ) ; json = getStringFromInputStream ( inputStream ) ; if ( logger . isLoggable ( Level . FINE ) ) logger . fine ( "Incoming JSON Entity: " + json ) ; result = getGson ( ) . fromJson ( json , jsonType ) ; } catch ( JsonSyntaxException e ) { logger . severe ( "Error in Incoming JSON Entity: " + json ) ; } finally { if ( inputStreamReader != null ) inputStreamReader . close ( ) ; } return result ; }
Read a type from the InputStream .