Package org.codehaus.jackson

Examples of org.codehaus.jackson.JsonFactory.createJsonParser()


  @NotNull
  @Override
  public T deserialize( @NotNull InputStream in ) throws IOException, VersionException {
    try {
      JsonFactory jsonFactory = JacksonSupport.getJsonFactory();
      JsonParser parser = jsonFactory.createJsonParser( in );

      T deserialized = deserialize( parser );

      ensureParserClosed( parser );
      return deserialized;
View Full Code Here


    }

    JsonFactory jsonFactory = JacksonSupport.getJsonFactory();
    InputStream entityInputStream = response.getEntityInputStream();
    try {
      JsonParser parser = jsonFactory.createJsonParser( entityInputStream );
      JacksonParserWrapper wrapper = new JacksonParserWrapper( parser );

      wrapper.nextToken( JsonToken.START_OBJECT );

      wrapper.nextFieldValue( "_id" );
View Full Code Here

  @Nonnull
  public UniqueId deserialize( @Nonnull InputStream in ) throws VersionException {
    try {
      JsonFactory jsonFactory = JacksonSupport.getJsonFactory();

      JsonParser parser = jsonFactory.createJsonParser( in );
      AbstractJacksonSerializer.nextToken( parser, JsonToken.START_OBJECT );

      UniqueId deserialized = deserialize( parser );

      AbstractJacksonSerializer.ensureParserClosedObject( parser );
View Full Code Here

  @Nonnull
  public <K, V, D> Row<K, V, D> deserialize( @Nonnull JacksonSerializer<? super K> keySerializer, @Nonnull JacksonSerializer<? super V> valueSerializer, @Nullable JacksonSerializer<? extends D> documentSerializer, @Nonnull InputStream in ) throws IOException, InvalidTypeException {
    JsonFactory jsonFactory = JacksonSupport.getJsonFactory();

    JsonParser parser = jsonFactory.createJsonParser( in );
    AbstractJacksonSerializer.nextToken( parser, JsonToken.START_OBJECT );

    return deserialize( keySerializer, valueSerializer, documentSerializer, parser );
  }
View Full Code Here

  }

  @Nonnull
  protected static JsonParser createJsonParser( @Nonnull InputStream in ) throws IOException {
    JsonFactory jsonFactory = JacksonSupport.getJsonFactory();
    return jsonFactory.createJsonParser( in );
  }

  @Nonnull
  protected static JsonGenerator createJsonGenerator( @Nonnull OutputStream out ) throws IOException {
    JsonFactory jsonFactory = JacksonSupport.getJsonFactory();
View Full Code Here

    return deserialize( keySerializer, valueSerializer, null, in );
  }

  public <K, V, D> ViewResponse<K, V, D> deserialize( @Nonnull JacksonSerializer<? super K> keySerializer, @Nonnull JacksonSerializer<? super V> valueSerializer, @Nullable JacksonSerializer<? extends D> documentSerializer, @Nonnull InputStream in ) throws IOException, InvalidTypeException {
    JsonFactory jsonFactory = JacksonSupport.getJsonFactory();
    JsonParser parser = jsonFactory.createJsonParser( in );

    AbstractJacksonSerializer.nextToken( parser, JsonToken.START_OBJECT );


    int totalRows = -1;
View Full Code Here

        keys = new HashSet<String>();
        discoveredI18nMap.put(locale, keys);
      }
      is = TranslationServiceGenerator.class.getClassLoader().getResourceAsStream(bundlePath);
      JsonFactory jsonFactory = new JsonFactory();
      JsonParser jp = jsonFactory.createJsonParser(is);
      JsonToken token = jp.nextToken();
      while (token != null) {
        token = jp.nextToken();
        if (token == JsonToken.FIELD_NAME) {
          String name = jp.getCurrentName();
View Full Code Here

        g.flush();

        String jsonExpression = sWriter.toString();
        System.out.println(jsonExpression);

        JsonParser parser = factory.createJsonParser(new StringReader(jsonExpression));

        Unmarshaller unmarshaller = ctx.createUnmarshaller();
        Object unmarshalledBean = unmarshaller.unmarshal(new Jackson2StaxReader(parser));

        System.out.println(String.format("Unmarshalled bean = %s", unmarshalledBean));
View Full Code Here

    r.put(stringField.name(), "hello\nthere\"\tyou}");
    r.put(enumField.name(), new GenericData.EnumSymbol(enumField.schema(),"a"));
   
    String json = r.toString();
    JsonFactory factory = new JsonFactory();
    JsonParser parser = factory.createJsonParser(json);
    ObjectMapper mapper = new ObjectMapper();
   
    // will throw exception if string is not parsable json
    mapper.readTree(parser);
  }
View Full Code Here

     * @param strategy
     * @throws IOException
     */
    public static void importFromStream(KeycloakSession session, ObjectMapper mapper, InputStream is, Strategy strategy) throws IOException {
        JsonFactory factory = mapper.getJsonFactory();
        JsonParser parser = factory.createJsonParser(is);
        try {
            parser.nextToken();

            if (parser.getCurrentToken() == JsonToken.START_ARRAY) {
                // Case with more realms in stream
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.