Package org.codehaus.jackson

Examples of org.codehaus.jackson.JsonToken


     */
    public boolean hasNextValue() throws IOException {
        if (_parser == null) {
            return false;
        }
        JsonToken t = _parser.getCurrentToken();
        if (t == null) { // un-initialized or cleared; find next
            t = _parser.nextToken();
            // If EOF, no more
            if (t == null) {
                _parser.close();
View Full Code Here


  }

  @Override
  public boolean readBoolean() throws IOException {
    advance(Symbol.BOOLEAN);
    JsonToken t = in.getCurrentToken();
    if (t == JsonToken.VALUE_TRUE || t == JsonToken.VALUE_FALSE) {
      in.nextToken();
      return t == JsonToken.VALUE_TRUE;
    } else {
      throw error("boolean");
View Full Code Here

 
  private static List<JsonElement> getVaueAsTree(JsonParser in) throws IOException {
    int level = 0;
    List<JsonElement> result = new ArrayList<JsonElement>();
    do {
      JsonToken t = in.getCurrentToken();
      switch (t) {
      case START_OBJECT:
      case START_ARRAY:
        level++;
        result.add(new JsonElement(t));
View Full Code Here

        if(lastRepeated)
        {
            if(parser.getCurrentToken() == VALUE_NULL)
            {
                // skip null elements
                JsonToken jt;
                while(VALUE_NULL == (jt = parser.nextToken()));
               
                if(jt == END_ARRAY)
                {
                    // remaining elements were all null
View Full Code Here

            final String name = parser.getCurrentName();
           
            // move to the next token
            if(parser.nextToken() == START_ARRAY)
            {
                JsonToken jt = parser.nextToken();
               
                // if empty array, read the next field
                if(jt == END_ARRAY)
                    continue;
               
View Full Code Here

        }
    }

    public boolean readBool() throws IOException
    {
        final JsonToken jt = parser.getCurrentToken();
        if(lastRepeated && parser.nextToken()==END_ARRAY)
            lastRepeated = false;
       
        if(jt==VALUE_TRUE)
            return true;
View Full Code Here

            {
                try
                {
                    JsonFactory f = new JsonFactory();
                    JsonParser p = f.createJsonParser(assumptionFile);
                    JsonToken token = p.nextToken();
                    while (token != JsonToken.END_OBJECT)
                    {
                        if (token == JsonToken.FIELD_NAME)
                        {
                            String keyspace = p.getText();
View Full Code Here

    try {
      p = jsonFactory.createJsonParser(new ByteArrayInputStream((t.getBytes())));
      if (p.nextToken() != JsonToken.START_OBJECT) {
        throw new IOException("Start token not found where expected");
      }
      JsonToken token;
      while (((token = p.nextToken()) != JsonToken.END_OBJECT) && (token != null)) {
        // iterate through each token, and create appropriate object here.
        populateRecord(r, token, p, schema);
      }
    } catch (JsonParseException e) {
View Full Code Here

   */
  private Object extractCurrentField(JsonParser p, Type t,
                     HCatFieldSchema hcatFieldSchema, boolean isTokenCurrent) throws IOException, JsonParseException,
    HCatException {
    Object val = null;
    JsonToken valueToken;
    if (isTokenCurrent) {
      valueToken = p.getCurrentToken();
    } else {
      valueToken = p.nextToken();
    }
View Full Code Here

    {
        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

TOP

Related Classes of org.codehaus.jackson.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.