當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonToken.START_ARRAY屬性代碼示例

本文整理匯總了Java中org.codehaus.jackson.JsonToken.START_ARRAY屬性的典型用法代碼示例。如果您正苦於以下問題:Java JsonToken.START_ARRAY屬性的具體用法?Java JsonToken.START_ARRAY怎麽用?Java JsonToken.START_ARRAY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.codehaus.jackson.JsonToken的用法示例。


在下文中一共展示了JsonToken.START_ARRAY屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parse

public void parse(HttpRequest req) throws IOException {

      final JsonParser parser = jsonFactory.createJsonParser(
              new ChannelBufferInputStream(req.getContent()));

      parser.nextToken(); // Skip the wrapper

      while (parser.nextToken() != JsonToken.END_OBJECT) {

        final String metric = parser.getCurrentName();

        JsonToken currentToken = parser.nextToken();
        if (currentToken == JsonToken.START_OBJECT) {
          parseMetricObject(metric, parser);
        } else if (currentToken == JsonToken.START_ARRAY) {
          int illegalTokens = parseMetricArray(metric, parser);
          if(illegalTokens > 0) {
              logger.warn("{} illegal tokens encountered", illegalTokens);
          }
        } else {
          logger.warn("Illegal token: expected {} or {}, but was {}: {}",new Object[] {
                  JsonToken.START_OBJECT, JsonToken.START_ARRAY, currentToken, parser.getText()});
        }
      }
    }
 
開發者ID:yandex,項目名稱:opentsdb-flume,代碼行數:25,代碼來源:LegacyHttpSource.java

示例2: BackportedJacksonMappingIterator

@SuppressWarnings("unchecked")
protected BackportedJacksonMappingIterator(JavaType type, JsonParser jp, DeserializationContext ctxt, JsonDeserializer<?> deser) {
    _type = type;
    _parser = jp;
    _context = ctxt;
    _deserializer = (JsonDeserializer<T>) deser;

    /* One more thing: if we are at START_ARRAY (but NOT root-level
     * one!), advance to next token (to allow matching END_ARRAY)
     */
    if (jp != null && jp.getCurrentToken() == JsonToken.START_ARRAY) {
        JsonStreamContext sc = jp.getParsingContext();
        // safest way to skip current token is to clear it (so we'll advance soon)
        if (!sc.inRoot()) {
            jp.clearCurrentToken();
        }
    }
}
 
開發者ID:xushjie1987,項目名稱:es-hadoop-v2.2.0,代碼行數:18,代碼來源:BackportedJacksonMappingIterator.java

示例3: _nextAfterName

private final JsonToken _nextAfterName()
{
  this._nameCopied = false;
  JsonToken localJsonToken = this._nextToken;
  this._nextToken = null;
  if (localJsonToken == JsonToken.START_ARRAY)
    this._parsingContext = this._parsingContext.createChildArrayContext(this._tokenInputRow, this._tokenInputCol);
  while (true)
  {
    this._currToken = localJsonToken;
    return localJsonToken;
    if (localJsonToken != JsonToken.START_OBJECT)
      continue;
    this._parsingContext = this._parsingContext.createChildObjectContext(this._tokenInputRow, this._tokenInputCol);
  }
}
 
開發者ID:zhangjianying,項目名稱:12306-android-Decompile,代碼行數:16,代碼來源:ReaderBasedParser.java

示例4: TreeTraversingParser

public TreeTraversingParser(JsonNode paramJsonNode, ObjectCodec paramObjectCodec)
{
  super(0);
  this._objectCodec = paramObjectCodec;
  if (paramJsonNode.isArray())
  {
    this._nextToken = JsonToken.START_ARRAY;
    this._nodeCursor = new NodeCursor.Array(paramJsonNode, null);
    return;
  }
  if (paramJsonNode.isObject())
  {
    this._nextToken = JsonToken.START_OBJECT;
    this._nodeCursor = new NodeCursor.Object(paramJsonNode, null);
    return;
  }
  this._nodeCursor = new NodeCursor.RootValue(paramJsonNode, null);
}
 
開發者ID:zhangjianying,項目名稱:12306-android-Decompile,代碼行數:18,代碼來源:TreeTraversingParser.java

示例5: readArrayStart

@Override
public long readArrayStart() throws IOException {
	advance(Symbol.ARRAY_START);
	if (in.getCurrentToken() == JsonToken.START_ARRAY) {
		in.nextToken();
		return doArrayNext();
	} else {
		throw error("array-start");
	}
}
 
開發者ID:Celos,項目名稱:avro-json-decoder,代碼行數:10,代碼來源:ExtendedJsonDecoder.java

示例6: skipArray

@Override
public long skipArray() throws IOException {
	advance(Symbol.ARRAY_START);
	if (in.getCurrentToken() == JsonToken.START_ARRAY) {
		in.skipChildren();
		in.nextToken();
		advance(Symbol.ARRAY_END);
	} else {
		throw error("array-start");
	}
	return 0;
}
 
開發者ID:Celos,項目名稱:avro-json-decoder,代碼行數:12,代碼來源:ExtendedJsonDecoder.java

示例7: registJsonEntityData

/**
 * 10_relations.json, 20_roles.json, 30_extroles.json, 70_$links.json, 10_odatarelations.jsonのバリデートチェック.
 * @param jp Jsonパース
 * @param mapper ObjectMapper
 * @param jsonName ファイル名
 * @throws IOException IOException
 */
protected void registJsonEntityData(JsonParser jp, ObjectMapper mapper, String jsonName) throws IOException {
    JsonToken token;
    token = jp.nextToken();

    // Relations,Roles,ExtRoles,$linksのチェック
    checkMatchFieldName(jp, jsonName);

    token = jp.nextToken();
    // 配列でなければエラー
    if (token != JsonToken.START_ARRAY) {
        throw PersoniumCoreException.BarInstall.JSON_FILE_FORMAT_ERROR.params(jsonName);
    }
    token = jp.nextToken();

    while (jp.hasCurrentToken()) {
        if (token == JsonToken.END_ARRAY) {
            break;
        } else if (token != JsonToken.START_OBJECT) {
            throw PersoniumCoreException.BarInstall.JSON_FILE_FORMAT_ERROR.params(jsonName);
        }

        // 1件登録処理
        JSONMappedObject mappedObject = barFileJsonValidate(jp, mapper, jsonName);
        if (jsonName.equals(RELATION_JSON)) {
            createRelation(mappedObject.getJson());
        } else if (jsonName.equals(ROLE_JSON)) {
            createRole(mappedObject.getJson());
        } else if (jsonName.equals(EXTROLE_JSON)) {
            createExtRole(mappedObject.getJson());
        } else if (jsonName.equals(LINKS_JSON)) {
            createLinks(mappedObject, odataProducer);
        }

        token = jp.nextToken();
    }
}
 
開發者ID:personium,項目名稱:personium-core,代碼行數:43,代碼來源:BarFileReadRunner.java

示例8: readArrayStart

@Override
public long readArrayStart() throws IOException {
  advance(Symbol.ARRAY_START);
  if (in.getCurrentToken() == JsonToken.START_ARRAY) {
    in.nextToken();
    return doArrayNext();
  } else {
    throw error("array-start");
  }
}
 
開發者ID:openaire,項目名稱:iis,代碼行數:10,代碼來源:HackedJsonDecoder.java

示例9: skipArray

@Override
public long skipArray() throws IOException {
  advance(Symbol.ARRAY_START);
  if (in.getCurrentToken() == JsonToken.START_ARRAY) {
    in.skipChildren();
    in.nextToken();
    advance(Symbol.ARRAY_END);    
  } else {
    throw error("array-start");
  }
  return 0;
}
 
開發者ID:openaire,項目名稱:iis,代碼行數:12,代碼來源:HackedJsonDecoder.java

示例10: processing

public void processing(Callback callback) throws IOException {
    JsonToken current = parser.nextToken();

    /** the following read from a big json array **/
    if (current == JsonToken.START_ARRAY) {
        // For each of the records in the array
        while (parser.nextToken() != JsonToken.END_ARRAY) {
            // read the record into a tree model,
            // this moves the parsing position to the end of it
            JsonNode node = parser.readValueAsTree();
            callback.processSingleJSONRecord(node);
        }
    }
}
 
開發者ID:NCBI-Hackathons,項目名稱:seqr,代碼行數:14,代碼來源:JsonStreamParser.java

示例11: ingestArray

public int ingestArray(String type, Class c, Map<String,EngineType> typeinfo,
                       JsonParser p) {
  int count = 0;
  try {
    if(p.getCurrentToken() != JsonToken.START_ARRAY) return 0;
    p.nextToken();
    while(p.getCurrentToken() != JsonToken.END_ARRAY) {
      count += ingestObject(type, c, typeinfo, p);
    }
    p.nextToken();
  }
  catch(IOException e) { logger.error(e); }
  catch(EngineJSONUtil.MalformedEngineJSON je) { logger.error(je); }
  return count;
}
 
開發者ID:circonus-labs,項目名稱:logstream,代碼行數:15,代碼來源:EngineIngestorHandler.java

示例12: deserializeTypedFromAny

public Object deserializeTypedFromAny(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  if (paramJsonParser.getCurrentToken() == JsonToken.START_ARRAY)
    return super.deserializeTypedFromArray(paramJsonParser, paramDeserializationContext);
  return deserializeTypedFromObject(paramJsonParser, paramDeserializationContext);
}
 
開發者ID:zhangjianying,項目名稱:12306-android-Decompile,代碼行數:7,代碼來源:AsPropertyTypeDeserializer.java

示例13: MappingIterator

protected MappingIterator(JavaType paramJavaType, JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, JsonDeserializer<?> paramJsonDeserializer)
{
  this._type = paramJavaType;
  this._parser = paramJsonParser;
  this._context = paramDeserializationContext;
  this._deserializer = paramJsonDeserializer;
  if ((paramJsonParser != null) && (paramJsonParser.getCurrentToken() == JsonToken.START_ARRAY) && (!paramJsonParser.getParsingContext().inRoot()))
    paramJsonParser.clearCurrentToken();
}
 
開發者ID:zhangjianying,項目名稱:12306-android-Decompile,代碼行數:9,代碼來源:MappingIterator.java

示例14: getCurrentName

public String getCurrentName()
  throws IOException, JsonParseException
{
  if ((this._currToken == JsonToken.START_OBJECT) || (this._currToken == JsonToken.START_ARRAY))
    return this._parsingContext.getParent().getCurrentName();
  return this._parsingContext.getCurrentName();
}
 
開發者ID:zhangjianying,項目名稱:12306-android-Decompile,代碼行數:7,代碼來源:JsonParserBase.java

示例15: skipChildren

public JsonParser skipChildren()
  throws IOException, JsonParseException
{
  if (this._currToken == JsonToken.START_OBJECT)
  {
    this._startContainer = false;
    this._currToken = JsonToken.END_OBJECT;
  }
  do
    return this;
  while (this._currToken != JsonToken.START_ARRAY);
  this._startContainer = false;
  this._currToken = JsonToken.END_ARRAY;
  return this;
}
 
開發者ID:zhangjianying,項目名稱:12306-android-Decompile,代碼行數:15,代碼來源:TreeTraversingParser.java


注:本文中的org.codehaus.jackson.JsonToken.START_ARRAY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。