Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonFactory.createJsonParser()


  final JsonParser jsonParser;

  JsonMetricDataStream(InputStream is) throws IOException {
    JsonFactory jsonFactory = new JsonFactory();
    this.jsonParser = jsonFactory.createJsonParser(is);
  }

  @Override
  public void close() throws IOException {
    jsonParser.close();
View Full Code Here


    diffSchema = new DiffSchema();
    removedFields = Lists.newArrayList();

    try {
      JsonFactory factory = new JsonFactory();
      parser = factory.createJsonParser(fileSystem.open(hadoopPath));
      parser.nextToken(); // Read to the first START_OBJECT token
      generator = new SchemaIdGenerator();
    } catch (IOException e) {
      throw new ExecutionSetupException(e);
    }
View Full Code Here

    private Map<String, String> parseJSON(String jsonmessage){
        Map<String, String> parsed = new HashMap<String, String>();
        JsonFactory jf = new JsonFactory();
        try {
            JsonParser parser = jf.createJsonParser(jsonmessage);
            parser.nextToken(); //shift past the START_OBJECT that begins the JSON
            while (parser.nextToken() != JsonToken.END_OBJECT) {
                String fieldname = parser.getCurrentName();
                parser.nextToken(); // move to value, or START_OBJECT/START_ARRAY
                String value;
View Full Code Here

      if(StringUtils.isEmpty(body)){
        return false;
      }else{
        ObjectMapper mapper = new ObjectMapper();
        JsonFactory factory = mapper.getJsonFactory(); // since 2.1 use mapper.getFactory() instead
        JsonParser jp = factory.createJsonParser(body);
        JsonNode jn = mapper.readTree(jp);
        return validate(jn);
      }
    } catch (IOException e) {
      throw new BaasBoxSocialTokenValidationException("There was an error in the token validation process:"+e.getMessage());
View Full Code Here

     * Mandatory
     */
    public void read_config(InputStream in) throws Exception {

        JsonFactory f = new MappingJsonFactory();
        JsonParser jp = f.createJsonParser(in);

        JsonToken current;

        current = jp.nextToken();
        if (current != JsonToken.START_OBJECT) {
View Full Code Here

        }
    }

    public String groupFind(String findName, String findIndex, Integer ExpectInt) throws Exception {
        JsonFactory f = new MappingJsonFactory();
        JsonParser jp = f.createJsonParser(findIndex);

        int count = 0;
        int foundit = 0;
        String Result = null;
View Full Code Here

  }

  public AstNode parse(String className, Reader reader) throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    JsonFactory factory = mapper.getFactory();
    JsonParser parser = factory.createJsonParser(reader);
    String xName = className + System.currentTimeMillis();
    stack.add(new AstNode(xName, null, false)); //artificial root element - must stay on the top of the Stack
    doField(className, parser);
    if (!xName.equals(stack.peek().getName())) {
      throw new IllegalStateException("Artificial element " + xName + " not found on the top of the stack");
View Full Code Here

    private static String doExtract(JsonExtractor<Slice> jsonExtractor, String json)
            throws IOException
    {
        JsonFactory jsonFactory = new JsonFactory();
        JsonParser jsonParser = jsonFactory.createJsonParser(json);
        jsonParser.nextToken(); // Advance to the first token
        Slice extract = jsonExtractor.extract(jsonParser);
        return (extract == null) ? null : extract.toString(Charsets.UTF_8);
    }
View Full Code Here

    private static String doExtract(JsonExtractor jsonExtractor, String json)
            throws IOException
    {
        JsonFactory jsonFactory = new JsonFactory();
        JsonParser jsonParser = jsonFactory.createJsonParser(json);
        jsonParser.nextToken(); // Advance to the first token
        Slice extract = jsonExtractor.extract(jsonParser);
        return (extract == null) ? null : extract.toString(Charsets.UTF_8);
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    private Object parseInputStream(InputStream in) throws BoxRestException {

        JsonFactory jsonFactory = new JsonFactory();
        try {
            JsonParser jp = jsonFactory.createJsonParser(in);
            return mObjectMapper.readValue(jp, objectClass);
        }
        catch (Exception e) {
            throw new BoxRestException(e, e.getMessage());
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.