Java 类org.codehaus.jackson.JsonToken 实例源码

项目:avro-json-decoder    文件:ExtendedJsonDecoder.java   
@Override
public String readString() throws IOException {
    advance(Symbol.STRING);
    if (parser.topSymbol() == Symbol.MAP_KEY_MARKER) {
        parser.advance(Symbol.MAP_KEY_MARKER);
        if (in.getCurrentToken() != JsonToken.FIELD_NAME) {
            throw error("map-key");
        }
    } else {
        if (in.getCurrentToken() != JsonToken.VALUE_STRING) {
            throw error("string");
        }
    }
    String result = in.getText();
    in.nextToken();
    return result;
}
项目:avro-json-decoder    文件:ExtendedJsonDecoder.java   
@Override
public int readEnum() throws IOException {
    advance(Symbol.ENUM);
    Symbol.EnumLabelsAction top = (Symbol.EnumLabelsAction) parser.popSymbol();
    if (in.getCurrentToken() == JsonToken.VALUE_STRING) {
        in.getText();
        int n = top.findLabel(in.getText());
        if (n >= 0) {
            in.nextToken();
            return n;
        }
        throw new AvroTypeException("Unknown symbol in enum " + in.getText());
    } else {
        throw error("fixed");
    }
}
项目:avro-json-decoder    文件:ExtendedJsonDecoder.java   
@Override
public int readIndex() throws IOException {
    advance(Symbol.UNION);
    Symbol.Alternative a = (Symbol.Alternative) parser.popSymbol();

    String label;
    if (in.getCurrentToken() == JsonToken.VALUE_NULL) {
        label = "null";
    } else if (in.getCurrentToken() == JsonToken.START_OBJECT &&
            in.nextToken() == JsonToken.FIELD_NAME) {
        label = in.getText();
        in.nextToken();
        parser.pushSymbol(Symbol.UNION_END);
    } else {
        throw error("start-union");
    }
    int n = a.findLabel(label);
    if (n < 0)
        throw new AvroTypeException("Unknown union branch " + label);
    parser.pushSymbol(a.getSymbol(n));
    return n;
}
项目:personium-core    文件:BarFileUtils.java   
/**
 * barファイルエントリからJSONファイルを読み込む.
 * @param <T> JSONMappedObject
 * @param inStream barファイルエントリのInputStream
 * @param entryName entryName
 * @param clazz clazz
 * @return JSONファイルから読み込んだオブジェクト
 * @throws IOException JSONファイル読み込みエラー
 */
public static <T> T readJsonEntry(
        InputStream inStream, String entryName, Class<T> clazz) throws IOException {
    JsonParser jp = null;
    ObjectMapper mapper = new ObjectMapper();
    JsonFactory f = new JsonFactory();
    jp = f.createJsonParser(inStream);
    JsonToken token = jp.nextToken(); // JSONルート要素("{")
    Pattern formatPattern = Pattern.compile(".*/+(.*)");
    Matcher formatMatcher = formatPattern.matcher(entryName);
    String jsonName = formatMatcher.replaceAll("$1");
    T json = null;
    if (token == JsonToken.START_OBJECT) {
        try {
            json = mapper.readValue(jp, clazz);
        } catch (UnrecognizedPropertyException ex) {
            throw PersoniumCoreException.BarInstall.JSON_FILE_FORMAT_ERROR.params(jsonName);
        }
    } else {
        throw PersoniumCoreException.BarInstall.JSON_FILE_FORMAT_ERROR.params(jsonName);
    }
    return json;
}
项目:personium-core    文件:EventResource.java   
/**
 * リクエストボディを解析してEventオブジェクトを取得する.
 * @param reader Http入力ストリーム
 * @return 解析したEventオブジェクト
 */
protected JSONEvent getRequestBody(final Reader reader) {
    JSONEvent event = null;
    JsonParser jp = null;
    ObjectMapper mapper = new ObjectMapper();
    JsonFactory f = new JsonFactory();
    try {
        jp = f.createJsonParser(reader);
        JsonToken token = jp.nextToken(); // JSONルート要素("{")
        if (token == JsonToken.START_OBJECT) {
            event = mapper.readValue(jp, JSONEvent.class);
        } else {
            throw PersoniumCoreException.Event.JSON_PARSE_ERROR;
        }
    } catch (IOException e) {
        throw PersoniumCoreException.Event.JSON_PARSE_ERROR;
    }
    return event;
}
项目:opentsdb-flume    文件:LegacyHttpSource.java   
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()});
        }
      }
    }
项目:opentsdb-flume    文件:LegacyHttpSource.java   
private int parseMetricArray(String metric, JsonParser parser) throws IOException {
  JsonToken currentToken;
  int illegalTokens = 0;

  while ((currentToken = parser.nextToken()) != JsonToken.END_ARRAY) {

    if(!currentToken.equals(JsonToken.START_OBJECT)) {
        logger.warn("Illegal token: expected {}, but was {}: {}",
                new Object[] {JsonToken.START_OBJECT, currentToken, parser.getText()});
        illegalTokens++;
    } else {
        parseMetricObject(metric, parser);
    }

  }

  return illegalTokens;
}
项目:es-hadoop-v2.2.0    文件:BackportedJacksonMappingIterator.java   
@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();
        }
    }
}
项目:es-hadoop-v2.2.0    文件:BackportedJacksonMappingIterator.java   
/**
 * Equivalent of {@link #next} but one that may throw checked
 * exceptions from Jackson due to invalid input.
 */
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();
            return false;
        }
        // And similarly if we hit END_ARRAY; except that we won't close parser
        if (t == JsonToken.END_ARRAY) {
            return false;
        }
    }
    return true;
}
项目:playground    文件:InstantDeserializer.java   
@Override
public Instant deserialize(final JsonParser parser, final DeserializationContext ctxt)
        throws IOException, JsonProcessingException
{
    final JsonToken jsonToken = parser.getCurrentToken();

    if (jsonToken == JsonToken.VALUE_NUMBER_INT)
    {
        return new Instant(parser.getLongValue());
    }
    else if (jsonToken == JsonToken.VALUE_STRING)
    {
        final String str = parser.getText().trim();
        if (str.length() == 0)
        {
            return null;
        }
        final DateTimeFormatter formatter = ISODateTimeFormat.dateTimeParser();
        final DateTime dateTime = formatter.parseDateTime(str);

        return new Instant(dateTime.getMillis());
    }

    throw ctxt.mappingException(Instant.class);
}
项目:hadoop-EAR    文件:ClusterNode.java   
/**
 * Reads the list of grants from the JSON stream
 *  @param coronaSerializer The CoronaSerializer instance being used to read
 *                          the JSON from disk
 * @throws IOException
 */
private void readGrants(CoronaSerializer coronaSerializer)
  throws IOException {
  // Expecting the START_OBJECT token for grants
  coronaSerializer.readStartObjectToken("grants");
  JsonToken current = coronaSerializer.nextToken();
  while (current != JsonToken.END_OBJECT) {
    // We can access the key for the grant, but it is not required
    // Expecting the START_OBJECT token for the grant
    coronaSerializer.readStartObjectToken("grant");

    coronaSerializer.readField("grantId");
    GrantId grantId = new GrantId(coronaSerializer);
    coronaSerializer.readField("grant");
    ResourceRequestInfo resourceRequestInfo =
      new ResourceRequestInfo(coronaSerializer);

    // Expecting the END_OBJECT token for the grant
    coronaSerializer.readEndObjectToken("grant");

    // This will update the grants map and the resourceTypeToStatsMap map
    addGrant(grantId.getSessionId(), resourceRequestInfo);

    current = coronaSerializer.nextToken();
  }
}
项目:hadoop-EAR    文件:SessionManager.java   
/**
 * Reads back the sessions map from a JSON stream
 *
 * @param coronaSerializer The CoronaSerializer instance to be used to
 *                         read the JSON
 * @throws IOException
 */
private void readSessions(CoronaSerializer coronaSerializer)
  throws IOException {
  coronaSerializer.readField("sessions");
  // Expecting the START_OBJECT token for sessions
  coronaSerializer.readStartObjectToken("sessions");
  JsonToken current = coronaSerializer.nextToken();
  while (current != JsonToken.END_OBJECT) {
    String sessionId = coronaSerializer.getFieldName();
    Session session = new Session(clusterManager.conf.getCMHeartbeatDelayMax(),
      coronaSerializer);
    sessions.put(sessionId, session);
    current = coronaSerializer.nextToken();
  }
  // Done with reading the END_OBJECT token for sessions
}
项目:hadoop-EAR    文件:Session.java   
/**
 * Reads the idToGrant map from a JSON stream
 *
 * @param coronaSerializer The CoronaSerializer instance to be used to
 *                         read the JSON
 * @throws IOException
 */
private void readIdToGrant(CoronaSerializer coronaSerializer)
  throws IOException {
  coronaSerializer.readField("idToGrant");
  // Expecting the START_OBJECT token for idToGrant
  coronaSerializer.readStartObjectToken("idToGrant");
  JsonToken current = coronaSerializer.nextToken();
  while (current != JsonToken.END_OBJECT) {
    Integer id = Integer.parseInt(coronaSerializer.getFieldName());
    ResourceGrant resourceGrant =
      coronaSerializer.readValueAs(ResourceGrant.class);
    idToGrant.put(id, new ResourceGrant(resourceGrant));
    current = coronaSerializer.nextToken();
  }
  // Done with reading the END_OBJECT token for idToGrant
}
项目:hadoop-EAR    文件:Session.java   
/**
 * Reads the typeToFirstWait map from the JSON stream
 *
 * @param coronaSerializer The CoronaSerializer instance to be used to
 *                         read the JSON
 * @throws IOException
 */
private void readTypeToFirstWait(CoronaSerializer coronaSerializer)
  throws IOException {
  coronaSerializer.readField("typeToFirstWait");
  // Expecting the START_OBJECT token for typeToFirstWait
  coronaSerializer.readStartObjectToken("typeToFirstWait");
  JsonToken current = coronaSerializer.nextToken();
  while (current != JsonToken.END_OBJECT) {
    String resourceTypeStr = coronaSerializer.getFieldName();
    Long wait = coronaSerializer.readValueAs(Long.class);
    current = coronaSerializer.nextToken();
    if (wait == -1) {
      wait = null;
    }
    typeToFirstWait.put(ResourceType.valueOf(resourceTypeStr), wait);
  }
  // Done with reading the END_OBJECT token for typeToFirstWait
}
项目:hadoop-EAR    文件:NodeManager.java   
/**
 * Reads the nameToNode map from the JSON stream
 * @param coronaSerializer The CoronaSerializer instance to be used to
 *                         read the JSON
 * @throws IOException
 */
private void readNameToNode(CoronaSerializer coronaSerializer)
  throws IOException {
  coronaSerializer.readField("nameToNode");
  // Expecting the START_OBJECT token for nameToNode
  coronaSerializer.readStartObjectToken("nameToNode");
  JsonToken current = coronaSerializer.nextToken();
  while (current != JsonToken.END_OBJECT) {
    // nodeName is the key, and the ClusterNode is the value here
    String nodeName = coronaSerializer.getFieldName();
    ClusterNode clusterNode = new ClusterNode(coronaSerializer);
    if (!nameToNode.containsKey(nodeName)) {
      nameToNode.put(nodeName, clusterNode);
    }
    current = coronaSerializer.nextToken();
  }
  // Done with reading the END_OBJECT token for nameToNode
}
项目:hadoop-EAR    文件:NodeManager.java   
/**
 * Reads the nameToApps map from the JSON stream
 * @param coronaSerializer The CoronaSerializer instance to be used to
 *                         read the JSON
 * @throws IOException
 */
private void readNameToApps(CoronaSerializer coronaSerializer)
  throws IOException {
  coronaSerializer.readField("nameToApps");
  // Expecting the START_OBJECT token for nameToApps
  coronaSerializer.readStartObjectToken("nameToApps");
  JsonToken current = coronaSerializer.nextToken();

  while (current != JsonToken.END_OBJECT) {
    String nodeName = coronaSerializer.getFieldName();
    // Expecting the START_OBJECT token for the Apps
    coronaSerializer.readStartObjectToken(nodeName);
    Map<String, String> appMap = coronaSerializer.readValueAs(Map.class);
    Map<ResourceType, String> appsOnNode =
      new HashMap<ResourceType, String>();

    for (Map.Entry<String, String> entry : appMap.entrySet()) {
      appsOnNode.put(ResourceType.valueOf(entry.getKey()),
        entry.getValue());
    }

    nameToApps.put(nodeName, appsOnNode);
    current = coronaSerializer.nextToken();
  }
}
项目:majordodo    文件:BrokerStatusSnapshot.java   
private static SlotStatus readSlotStatus(JsonParser jParser) throws IOException {
    SlotStatus res = new SlotStatus();

    while (jParser.nextToken() != JsonToken.END_OBJECT) {
        switch (jParser.getCurrentName() + "") {
            case "slotId":
                nextToken(jParser);
                res.setSlot(readValue(jParser));
                break;
            default:
                throw new IOException("Unexpected field " + jParser.getCurrentName());
        }
    }

    return res;
}
项目:Rosetta.NetAppStoragePlugin    文件:CDMIConnector.java   
private String getSpecificJSONValue(HttpResponse response, String jsonKey) throws JsonParseException, IllegalStateException, IOException {
    InputStream content = response.getEntity().getContent();
    if (isSuccessfulResponse(response)) {
        JsonFactory f = new JsonFactory();
        JsonParser jp = f.createJsonParser(content);
        while ((jp.nextToken()) != JsonToken.END_OBJECT) {
            if (jsonKey.equals(jp.getCurrentName())) {
                jp.nextToken();
                return jp.getText();
            }
        }
    } else {
        String string = IOUtils.toString(content);
        System.err.println(string);
    }
    return null;
}
项目:ODFExplorer    文件:StyleJSONReader.java   
private static void findDiffProp(JsonParser jParser) throws JsonParseException, IOException {
        String propName = null;
        String val1 = null;
        String val2 = null;
        while (jParser.nextToken() != JsonToken.END_ARRAY) {

            String fieldname = jParser.getCurrentName();
            if ("name".equals(fieldname)) {
//              System.out.println("iterating children");
                jParser.nextToken(); 
                propName = jParser.getText();
            }
            if ("value1".equals(fieldname)) {
//              System.out.println("Diff property");
                jParser.nextToken(); 
                val1 = jParser.getText();
            }
            if ("value2".equals(fieldname)) {
                jParser.nextToken(); 
                val2 = jParser.getText();
                System.out.println("Diff " + propName + " " + val1 + " -> " + val2);
                propDiffCount++;
            }
        }

    }
项目:appverse-server    文件:CustomMappingJacksonHttpMessageConverter.java   
protected Object[] readInternal(Class<?>[] parameterTypes, String payload) throws Exception {
    JsonFactory jsonFactory = this.objectMapper.getJsonFactory();
    JsonParser jp = jsonFactory.createJsonParser(payload);
    JsonToken token;
    List<Object> lObjs = new ArrayList<Object>();
    int i=0;
    while ((token = jp.nextToken()) != null) {
        switch (token) {
            case VALUE_NUMBER_INT:
               case VALUE_STRING:
            case START_OBJECT:
                Object obj = jp.readValueAs(parameterTypes[i]);
                lObjs.add(obj);
                i++;
                break;
        default:
            break;
        }
    }
    if( lObjs.size() != parameterTypes.length) {
        throw new Exception("Parsed parameters do not match requested types.");
    }
    Object [] parametersFound = lObjs.toArray();
    return parametersFound;
}
项目:Rosetta.dps-sdk-projects    文件:CDMIConnector.java   
private String getSpecificJSONValue(HttpResponse response, String jsonKey) throws JsonParseException, IllegalStateException, IOException {
    InputStream content = response.getEntity().getContent();
    if (isSuccessfulResponse(response)) {
        JsonFactory f = new JsonFactory();
        JsonParser jp = f.createJsonParser(content);
        while ((jp.nextToken()) != JsonToken.END_OBJECT) {
            if (jsonKey.equals(jp.getCurrentName())) {
                jp.nextToken();
                return jp.getText();
            }
        }
    } else {
        String string = IOUtils.toString(content);
        System.err.println(string);
    }
    return null;
}
项目:Rosetta.dps-sdk-projects    文件:CDMIConnector.java   
private String getSpecificJSONValue(HttpResponse response, String jsonKey) throws JsonParseException, IllegalStateException, IOException {
    InputStream content = response.getEntity().getContent();
    if (isSuccessfulResponse(response)) {
        JsonFactory f = new JsonFactory();
        JsonParser jp = f.createJsonParser(content);
        while ((jp.nextToken()) != JsonToken.END_OBJECT) {
            if (jsonKey.equals(jp.getCurrentName())) {
                jp.nextToken();
                return jp.getText();
            }
        }
    } else {
        String string = IOUtils.toString(content);
        System.err.println(string);
    }
    return null;
}
项目:Rosetta.dps-sdk-projects    文件:CDMIConnector.java   
private String getSpecificJSONValue(HttpResponse response, String jsonKey) throws JsonParseException, IllegalStateException, IOException {
    InputStream content = response.getEntity().getContent();
    if (isSuccessfulResponse(response)) {
        JsonFactory f = new JsonFactory();
        JsonParser jp = f.createJsonParser(content);
        while ((jp.nextToken()) != JsonToken.END_OBJECT) {
            if (jsonKey.equals(jp.getCurrentName())) {
                jp.nextToken();
                return jp.getText();
            }
        }
    } else {
        String string = IOUtils.toString(content);
        System.err.println(string);
    }
    return null;
}
项目:iis    文件:HackedJsonDecoder.java   
@Override
public String readString() throws IOException {
  advance(Symbol.STRING);
  if (parser.topSymbol() == Symbol.MAP_KEY_MARKER) {
    parser.advance(Symbol.MAP_KEY_MARKER);
    if (in.getCurrentToken() != JsonToken.FIELD_NAME) {
      throw error("map-key");
    }
  } else {
    if (in.getCurrentToken() != JsonToken.VALUE_STRING) {
      throw error("string");
    }
  }
  String result = in.getText();
  in.nextToken();
  return result;
}
项目:iis    文件:HackedJsonDecoder.java   
@Override
public int readEnum() throws IOException {
  advance(Symbol.ENUM);
  Symbol.EnumLabelsAction top = (Symbol.EnumLabelsAction) parser.popSymbol();
  if (in.getCurrentToken() == JsonToken.VALUE_STRING) {
    in.getText();
    int n = top.findLabel(in.getText());
    if (n >= 0) {
      in.nextToken();
      return n;
    }
    throw new AvroTypeException("Unknown symbol in enum " + in.getText());
  } else {
    throw error("fixed");
  }
}
项目:community-edition-old    文件:NodeRefDeserializer.java   
@Override
public NodeRef deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException
{
       JsonToken curr = jp.getCurrentToken();

       if (curr == JsonToken.VALUE_STRING)
       {
           String nodeRefString = jp.getText();
           NodeRef nodeRef = getNodeRef(nodeRefString);
           return nodeRef;
       }
       else
       {
        throw new IOException("Unable to deserialize nodeRef: " + curr.asString());
       }
}
项目:12306-android-Decompile    文件:ReaderBasedParser.java   
protected void _matchToken(JsonToken paramJsonToken)
  throws IOException, JsonParseException
{
  String str = paramJsonToken.asString();
  int i = 1;
  int j = str.length();
  while (i < j)
  {
    if ((this._inputPtr >= this._inputEnd) && (!loadMore()))
      _reportInvalidEOF(" in a value");
    if (this._inputBuffer[this._inputPtr] != str.charAt(i))
      _reportInvalidToken(str.substring(0, i), "'null', 'true' or 'false'");
    this._inputPtr = (1 + this._inputPtr);
    i++;
  }
}
项目:Aeron    文件:MetadataValueDeserializer.java   
private Object getPEPCredentials(JsonParser jp) throws JsonParseException,
        IOException {
    JsonToken token = jp.getCurrentToken();

    PEPCredentials result = new PEPCredentials();

    while (!token.equals(JsonToken.END_OBJECT)) {
        token = jp.nextToken();
        if (jp.getCurrentName().equalsIgnoreCase("username")) {
            result.setUsername(jp.getText());
        } else if (jp.getCurrentName().equalsIgnoreCase("password")) {
            result.setPassword(jp.getText());
        } else {
            throw new JsonParseException(
                    "unknown field for pepcredentials", null);
        }
        token = jp.nextToken();
    }
    return result;
}
项目:Aeron    文件:MetadataValueDeserializer.java   
private Object getAsJsonString(JsonParser jp) throws JsonParseException,
        IOException {
    String asString = "";
    JsonToken token = jp.getCurrentToken();

    while (!token.equals(JsonToken.END_OBJECT)) {

        String key = jp.getText();
        token = jp.nextToken();
        String value = jp.getText();
        String.format("\"%s\" : \"%s\"", key, value);

        if (asString.isEmpty()) {
            asString += String.format("\"%s\" : \"%s\"", key, value);
        } else {
            asString += String.format(", \"%s\" : \"%s\"", key, value);
        }
        token = jp.nextToken();
    }
    asString = String.format("{%s}", asString);
    return asString;
}
项目:12306-android-Decompile    文件:MapDeserializer.java   
public Map<Object, Object> deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  JsonToken localJsonToken = paramJsonParser.getCurrentToken();
  if ((localJsonToken != JsonToken.START_OBJECT) && (localJsonToken != JsonToken.FIELD_NAME) && (localJsonToken != JsonToken.END_OBJECT))
    throw paramDeserializationContext.mappingException(getMapClass());
  if (this._propertyBasedCreator != null)
    return _deserializeUsingCreator(paramJsonParser, paramDeserializationContext);
  if (this._defaultCtor == null)
    throw paramDeserializationContext.instantiationException(getMapClass(), "No default constructor found");
  try
  {
    Map localMap = (Map)this._defaultCtor.newInstance(new Object[0]);
    _readAndBind(paramJsonParser, paramDeserializationContext, localMap);
    return localMap;
  }
  catch (Exception localException)
  {
  }
  throw paramDeserializationContext.instantiationException(getMapClass(), localException);
}
项目:12306-android-Decompile    文件:EnumSetDeserializer.java   
public EnumSet<?> deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  if (!paramJsonParser.isExpectedStartArrayToken())
    throw paramDeserializationContext.mappingException(EnumSet.class);
  EnumSet localEnumSet = constructSet();
  while (true)
  {
    JsonToken localJsonToken = paramJsonParser.nextToken();
    if (localJsonToken == JsonToken.END_ARRAY)
      break;
    if (localJsonToken == JsonToken.VALUE_NULL)
      throw paramDeserializationContext.mappingException(this._enumClass);
    localEnumSet.add(this._enumDeserializer.deserialize(paramJsonParser, paramDeserializationContext));
  }
  return localEnumSet;
}
项目:12306-android-Decompile    文件:NodeCursor.java   
public JsonToken nextToken()
{
  if (this._needEntry)
  {
    if (!this._contents.hasNext())
    {
      this._current = null;
      return null;
    }
    this._needEntry = false;
    this._current = ((Map.Entry)this._contents.next());
    return JsonToken.FIELD_NAME;
  }
  this._needEntry = true;
  return ((JsonNode)this._current.getValue()).asToken();
}
项目:spring-open    文件:IPv4Deserializer.java   
@Override
public IPv4 deserialize(JsonParser jp,
                        DeserializationContext ctxt)
        throws IOException, JsonProcessingException {

    IPv4 ipv4 = null;

    jp.nextToken();        // Move to JsonToken.START_OBJECT
    while (jp.nextToken() != JsonToken.END_OBJECT) {
        String fieldname = jp.getCurrentName();
        if ("value".equals(fieldname)) {
            String value = jp.getText();
            log.debug("Fieldname: {} Value: {}", fieldname, value);
            ipv4 = new IPv4(value);
        }
    }
    return ipv4;
}
项目:12306-android-Decompile    文件:Utf8StreamParser.java   
protected void _matchToken(JsonToken paramJsonToken)
  throws IOException, JsonParseException
{
  byte[] arrayOfByte = paramJsonToken.asByteArray();
  int i = 1;
  int j = arrayOfByte.length;
  while (i < j)
  {
    if (this._inputPtr >= this._inputEnd)
      loadMoreGuaranteed();
    if (arrayOfByte[i] != this._inputBuffer[this._inputPtr])
      _reportInvalidToken(paramJsonToken.asString().substring(0, i), "'null', 'true' or 'false'");
    this._inputPtr = (1 + this._inputPtr);
    i++;
  }
}
项目:12306-android-Decompile    文件:CollectionDeserializer.java   
private final Collection<Object> handleNonArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, Collection<Object> paramCollection)
  throws IOException, JsonProcessingException
{
  if (!paramDeserializationContext.isEnabled(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY))
    throw paramDeserializationContext.mappingException(this._collectionType.getRawClass());
  JsonDeserializer localJsonDeserializer = this._valueDeserializer;
  TypeDeserializer localTypeDeserializer = this._valueTypeDeserializer;
  Object localObject;
  if (paramJsonParser.getCurrentToken() == JsonToken.VALUE_NULL)
    localObject = null;
  while (true)
  {
    paramCollection.add(localObject);
    return paramCollection;
    if (localTypeDeserializer == null)
    {
      localObject = localJsonDeserializer.deserialize(paramJsonParser, paramDeserializationContext);
      continue;
    }
    localObject = localJsonDeserializer.deserializeWithType(paramJsonParser, paramDeserializationContext, localTypeDeserializer);
  }
}
项目:12306-android-Decompile    文件:EnumMapDeserializer.java   
public EnumMap<?, ?> deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  if (paramJsonParser.getCurrentToken() != JsonToken.START_OBJECT)
    throw paramDeserializationContext.mappingException(EnumMap.class);
  EnumMap localEnumMap = constructMap();
  if (paramJsonParser.nextToken() != JsonToken.END_OBJECT)
  {
    String str = paramJsonParser.getCurrentName();
    Enum localEnum = this._enumResolver.findEnum(str);
    if (localEnum == null)
      throw paramDeserializationContext.weirdStringException(this._enumResolver.getEnumClass(), "value not one of declared Enum instance names");
    if (paramJsonParser.nextToken() == JsonToken.VALUE_NULL);
    for (Object localObject = null; ; localObject = this._valueDeserializer.deserialize(paramJsonParser, paramDeserializationContext))
    {
      localEnumMap.put(localEnum, localObject);
      break;
    }
  }
  return localEnumMap;
}
项目:12306-android-Decompile    文件:SettableBeanProperty.java   
public final void deserializeAndSet(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, Object paramObject)
  throws IOException, JsonProcessingException
{
  if (paramJsonParser.getCurrentToken() == JsonToken.VALUE_NULL)
    return;
  Object localObject;
  try
  {
    localObject = this._getter.invoke(paramObject, new Object[0]);
    if (localObject == null)
      throw new JsonMappingException("Problem deserializing 'setterless' property '" + getName() + "': get method returned null");
  }
  catch (Exception localException)
  {
    _throwAsIOE(localException);
    return;
  }
  this._valueDeserializer.deserialize(paramJsonParser, paramDeserializationContext, localObject);
}
项目:12306-android-Decompile    文件:ReaderBasedParser.java   
public byte[] getBinaryValue(Base64Variant paramBase64Variant)
  throws IOException, JsonParseException
{
  if ((this._currToken != JsonToken.VALUE_STRING) && ((this._currToken != JsonToken.VALUE_EMBEDDED_OBJECT) || (this._binaryValue == null)))
    _reportError("Current token (" + this._currToken + ") not VALUE_STRING or VALUE_EMBEDDED_OBJECT, can not access as binary");
  if (this._tokenIncomplete);
  try
  {
    this._binaryValue = _decodeBase64(paramBase64Variant);
    this._tokenIncomplete = false;
    return this._binaryValue;
  }
  catch (IllegalArgumentException localIllegalArgumentException)
  {
  }
  throw _constructError("Failed to decode VALUE_STRING as base64 (" + paramBase64Variant + "): " + localIllegalArgumentException.getMessage());
}
项目:12306-android-Decompile    文件:EnumDeserializer.java   
public Object deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  if (paramJsonParser.getCurrentToken() != JsonToken.VALUE_STRING)
    throw paramDeserializationContext.mappingException(this._enumClass);
  String str = paramJsonParser.getText();
  try
  {
    Object localObject = this._factory.invoke(this._enumClass, new Object[] { str });
    return localObject;
  }
  catch (Exception localException)
  {
    ClassUtil.unwrapAndThrowAsIAE(localException);
  }
  return null;
}
项目:12306-android-Decompile    文件:StringCollectionDeserializer.java   
private Collection<String> deserializeUsingCustom(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, Collection<String> paramCollection)
  throws IOException, JsonProcessingException
{
  JsonDeserializer localJsonDeserializer = this._valueDeserializer;
  JsonToken localJsonToken = paramJsonParser.nextToken();
  if (localJsonToken != JsonToken.END_ARRAY)
  {
    if (localJsonToken == JsonToken.VALUE_NULL);
    for (Object localObject = null; ; localObject = (String)localJsonDeserializer.deserialize(paramJsonParser, paramDeserializationContext))
    {
      paramCollection.add(localObject);
      break;
    }
  }
  return (Collection<String>)paramCollection;
}