code: @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;
      }
docs: Read a type from the InputStream.
  @param type The type that is to be read from the entity stream
  @param genericType The type of instance to be produced
  @param annotations An array of the annotations on the declaration of the artifact that will be initialized with the produced instance
  @param mediaType The media type of the HTTP entity, if one is not specified in the request then application/octet-stream is used
  @param httpHeaders The read-only HTTP headers associated with HTTP entity
  @param inputStream The InputStream of the HTTP entity
  @return The type that was read from the stream