当前位置: 首页>>代码示例>>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;未经允许,请勿转载。