Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonToken


    {
        try
        {
            JsonParser jp = this.jsonFactory.createJsonParser( inputStream );
            DirectMemoryRequest rq = new DirectMemoryRequest();
            JsonToken jsonToken = jp.nextToken();
            while ( jsonToken != JsonToken.END_OBJECT && jsonToken != null )
            {
                String fieldName = jp.getCurrentName();
                if ( DirectMemoryConstants.KEY_FIELD_NAME.equals( fieldName ) )
                {
View Full Code Here


        try
        {
            JsonParser jp = this.jsonFactory.createJsonParser( inputStream );
            DirectMemoryResponse rs = new DirectMemoryResponse();

            JsonToken jsonToken = jp.nextToken();

            while ( jsonToken != JsonToken.END_OBJECT && jsonToken != null)
            {
                String fieldName = jp.getCurrentName();
                if ( DirectMemoryConstants.FOUND_FIELD_NAME.equals( fieldName ) )
View Full Code Here

  public int read( char[] destBuffer, int destOffset, int destCount ) throws IOException {
    int count = 0;
    int available = buffer.length() - offset;

    if( available == 0 ) {
      JsonToken token = parser.nextToken();
      if( token == null ) {
        count = -1;
      } else {
        processCurrentToken();
        available = buffer.length() - offset;
View Full Code Here

                    Object ob = typeDeserializer.deserializeTypedFromObject(jp, ctxt);
                    return _handleTypedObjectId(jp, ctxt, ob, id);
                }
            }
            // or, Object Ids Jackson explicitly sets
            JsonToken t = jp.getCurrentToken();
            // for now (2.2.x) we only allow scalar types (Strings, integral numbers):
            // NOTE: may  need to allow handling of structured values in future for JSOG
            if (t != null && t.isScalarValue()) {
                return deserializeFromObjectId(jp, ctxt);
            }
        }
        // In future could check current token... for now this should be enough:
        return typeDeserializer.deserializeTypedFromObject(jp, ctxt);
View Full Code Here

                    if ("rows".equals(name)) {
                        CouchJsonKey key = null;
                        while (parser.hasCurrentToken()) {
                            name = parser.getCurrentName();
                            if ("key".equals(name)) {
                                JsonToken token = parser.getCurrentToken();
                                if (token.isNumeric()) {
                                    key = new CouchJsonKey(parser.getNumberValue());
                                } else {
                                    key = new CouchJsonKey(parser.getText());
                                }
                            } else if ("value".equals(name)) {
View Full Code Here

    {
        /* 16-Feb-2012, tatu: ObjectId may be used as well... need to check
         *    that first
         */
        if (_objectIdReader != null) {
            JsonToken t = jp.getCurrentToken();
            // should be good enough check; we only care about Strings, integral numbers:
            if (t != null && t.isScalarValue()) {
                return deserializeFromObjectId(jp, ctxt);
            }
        }
        // In future could check current token... for now this should be enough:
        return typeDeserializer.deserializeTypedFromObject(jp, ctxt);
View Full Code Here

    public Map<String, String> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException,
      JsonProcessingException {

      Map<String, String> map = new HashMap<String, String>();

      JsonToken token;

      if ((token = jp.getCurrentToken()) != JsonToken.START_ARRAY)
        throw new JsonMappingException("expected start of array, but found " + token, jp.getCurrentLocation());

      while ((token = jp.nextToken()) == JsonToken.START_ARRAY) {
View Full Code Here

    public Map<String, String> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException,
      JsonProcessingException {

      Map<String, String> map = new HashMap<String, String>();

      JsonToken token;

      if ((token = jp.getCurrentToken()) != JsonToken.START_ARRAY)
        throw new JsonMappingException("expected start of array, but found " + token, jp.getCurrentLocation());

      while((token = jp.nextToken()) == JsonToken.START_ARRAY) {
View Full Code Here

  }

  @Nonnull
  @Override
  public Void deserialize( @Nonnull JsonParser deserializeFrom, @Nonnull Version formatVersion ) throws IOException, VersionException, JsonProcessingException {
    JsonToken inToken = deserializeFrom.nextToken();

    if ( isValueToken( inToken ) ) {
      deserializeFrom.nextToken();
      return null;
    }


    JsonToken outToken = findOutToken( inToken );

    int depth = 1;

    while ( depth > 0 ) {
      JsonToken next = deserializeFrom.nextToken();
      if ( next == inToken ) {
        depth++;
      }
      if ( next == outToken ) {
        depth--;
View Full Code Here

    parser.nextToken();
    verifyCurrentToken( expected );
  }

  public void verifyCurrentToken( @Nonnull JsonToken expected ) throws JsonParseException {
    JsonToken current = parser.getCurrentToken();
    if ( current != expected ) {
      throw new JsonParseException( "Invalid token. Expected <" + expected + "> but got <" + current + ">", parser.getCurrentLocation() );
    }
  }
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.core.JsonToken

Copyright © 2018 www.massapicom. 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.