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


Java JsonReader.nextString方法代碼示例

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


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

示例1: Port

import android.util.JsonReader; //導入方法依賴的package包/類
public Port(JsonReader jsonReader) throws IOException {
    jsonReader.beginObject();
    String id = null;
    String name = null;
    while (jsonReader.hasNext()) {
        String key = jsonReader.nextName();
        if (id == null && ID.equals(key)) {
            id = jsonReader.nextString();
        } else if (name == null && NAME.equals(key)) {
            name = jsonReader.nextString();
        } else {
            jsonReader.skipValue();
        }
    }
    jsonReader.endObject();
    this.id = id;
    this.name = name;
}
 
開發者ID:hortonworks,項目名稱:nifi-android-s2s,代碼行數:19,代碼來源:Port.java

示例2: IncomingMessage

import android.util.JsonReader; //導入方法依賴的package包/類
public IncomingMessage(String message) throws IOException {
    JsonReader reader = new JsonReader(new StringReader(message));
    reader.beginObject();
    if (reader.hasNext()) {
        String name = reader.nextName();
        if (name.equals("event")) {
            String typeString = reader.nextString();
            if (typeString.equals("action")) {
                eventType = EventType.ACTION;
            } else if (typeString.equals("dismiss")) {
                eventType = EventType.DISMISS;
            } else if (typeString.equals("blacklist")) {
                eventType = EventType.BLACKLIST;
            } else if (typeString.equals("sms")) {
                eventType = EventType.SMS;
            }
        }
    }
    jsonReader = reader;
}
 
開發者ID:RomascuAndrei,項目名稱:BTNotifierAndroid,代碼行數:21,代碼來源:IncomingMessage.java

示例3: readMessage

import android.util.JsonReader; //導入方法依賴的package包/類
/**
 * Paring object
 * @param reader
 * @return
 * @throws IOException
 */
private AboutRecord readMessage(JsonReader reader) throws IOException {
    String name = "";
    String description = "";

    reader.beginObject();
    while (reader.hasNext()) {
        String key = reader.nextName();

        if (key.equals("name")) {
            name = reader.nextString();

        } else if (key.equals("description")) {
            description = reader.nextString();

        } else {
            reader.skipValue();
        }
    }
    reader.endObject();
    return new AboutRecord(name, description);
}
 
開發者ID:HTBridge,項目名稱:pivaa,代碼行數:28,代碼來源:AboutJSONParser.java

示例4: readName

import android.util.JsonReader; //導入方法依賴的package包/類
private static String readName(JsonReader reader) throws IOException {
    reader.beginObject();
    String name;
    String returnValue = null;
    while ((name = getNextNotNullName(reader)) != null) {
        switch(MATCHER.match(name)) {
            case KEY_NAME:
                returnValue = reader.nextString();
                break;
            default:
                reader.skipValue();
        }
    }
    reader.endObject();
    return returnValue;
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:17,代碼來源:MovieIdParser.java

示例5: readDirector

import android.util.JsonReader; //導入方法依賴的package包/類
private static String readDirector(JsonReader reader) throws IOException {
    reader.beginObject();
    String name;
    String personName = null;
    boolean isDirector = false;
    while ((name = getNextNotNullName(reader)) != null) {
        switch(MATCHER.match(name)) {
            case KEY_NAME:
                personName = reader.nextString();
                break;
            case KEY_JOB:
                if (DIRECTOR.equals(reader.nextString()))
                    isDirector = true;
                break;
            default:
                reader.skipValue();
        }
    }
    reader.endObject();
    return isDirector ? personName : null;
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:22,代碼來源:MovieIdParser.java

示例6: readCountry

import android.util.JsonReader; //導入方法依賴的package包/類
private static String readCountry(JsonReader reader) throws IOException {
    String certification = null;
    boolean isUS = false;

    reader.beginObject();
    String name;
    while ((name = getNextNotNullName(reader)) != null) {
        switch(MATCHER.match(name)) {
            case KEY_CERTIFICATION:
                certification = reader.nextString();
                break;
            case KEY_ISO_3166:
                if (COUNTRY_US.equals(reader.nextString()))
                    isUS = true;
                break;
            default:
                reader.skipValue();
        }
    }
    reader.endObject();

    return isUS ? certification : null;
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:24,代碼來源:MovieIdParser.java

示例7: readImage

import android.util.JsonReader; //導入方法依賴的package包/類
private static Image readImage(JsonReader reader, String preferredLanguage, int imageNumber) throws IOException {
    reader.beginObject();
    String filePath = null;
    String language = null;
    String name;
    while ((name = getNextNotNullName(reader)) != null) {
        switch(MATCHER.match(name)) {
            case KEY_FILE_PATH:
                filePath = reader.nextString();
                break;
            case KEY_ISO_639_1:
                language = reader.nextString();
                break;
            default:
                reader.skipValue();
        }
    }
    reader.endObject();
    return new Image(filePath, language, preferredLanguage, imageNumber);
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:21,代碼來源:MovieIdImageParser.java

示例8: readRole

import android.util.JsonReader; //導入方法依賴的package包/類
private static Role readRole(JsonReader reader) throws IOException {
    String name = null;
    String description = null;
    reader.beginObject();
    while (reader.hasNext()) {
        String property = reader.nextName();
        switch (property) {
            case NAME_PROPERTY:
                name = reader.nextString();
                break;
            case DESCRIPTION_PROPERTY:
                description = reader.nextString();
                break;
            default:
                Log.w(LOG_TAG, "Unknown property: " + property);
                break;
        }
    }
    if (name == null || description == null) {
        Log.w(LOG_TAG, "name: " + name + ", description: " + description);
        return null;
    }
    reader.endObject();
    return new Role(name, description);
}
 
開發者ID:ilinum,項目名稱:werewolves-app,代碼行數:26,代碼來源:RoleLoader.java

示例9: readValue

import android.util.JsonReader; //導入方法依賴的package包/類
/** Reads the next value in the {@link JsonReader}. */
private static Object readValue(JsonReader reader) throws IOException {
  JsonToken token = reader.peek();
  switch (token) {
    case BEGIN_OBJECT:
      return readerToMap(reader);
    case BEGIN_ARRAY:
      return readerToList(reader);
    case BOOLEAN:
      return reader.nextBoolean();
    case NULL:
      reader.nextNull(); // consume the null token
      return null;
    case NUMBER:
      return reader.nextDouble();
    case STRING:
      return reader.nextString();
    default:
      throw new IllegalStateException("Invalid token " + token);
  }
}
 
開發者ID:f2prateek,項目名稱:segment-android,代碼行數:22,代碼來源:JsonUtils.java

示例10: parse

import android.util.JsonReader; //導入方法依賴的package包/類
static MergePaths parse(JsonReader reader) throws IOException {
  String name = null;
  MergePaths.MergePathsMode mode = null;

  while (reader.hasNext()) {
    switch (reader.nextName()) {
      case "nm":
        name = reader.nextString();
        break;
      case "mm":
        mode =  MergePaths.MergePathsMode.forId(reader.nextInt());
        break;
      default:
        reader.skipValue();
    }
  }

  return new MergePaths(name, mode);
}
 
開發者ID:airbnb,項目名稱:lottie-android,代碼行數:20,代碼來源:MergePathsParser.java

示例11: parse

import android.util.JsonReader; //導入方法依賴的package包/類
static ShapePath parse(
    JsonReader reader, LottieComposition composition) throws IOException {
  String name = null;
  int ind = 0;
  AnimatableShapeValue shape = null;

  while (reader.hasNext()) {
    switch (reader.nextName()) {
      case "nm":
        name = reader.nextString();
        break;
      case "ind":
        ind = reader.nextInt();
        break;
      case "ks":
        shape = AnimatableValueParser.parseShapeData(reader, composition);
        break;
      default:
        reader.skipValue();
    }
  }

  return new ShapePath(name, ind, shape);
}
 
開發者ID:airbnb,項目名稱:lottie-android,代碼行數:25,代碼來源:ShapePathParser.java

示例12: readPlaceTypesArray

import android.util.JsonReader; //導入方法依賴的package包/類
List<PlaceType> readPlaceTypesArray(JsonReader reader) throws IOException {
    List<PlaceType> types = new ArrayList<>();

    reader.beginArray();
    while (reader.hasNext()) {
        switch (reader.nextString()) {
            case "route":
                types.add(PlaceType.ROUTE);
                break;
            case "geocode":
                types.add(PlaceType.GEOCODE);
                break;
            default:
                reader.skipValue();
                break;
        }
    }
    reader.endArray();
    return types;
}
 
開發者ID:seatgeek,項目名稱:android-PlacesAutocompleteTextView,代碼行數:21,代碼來源:AndroidPlacesApiJsonParser.java

示例13: readWarranty

import android.util.JsonReader; //導入方法依賴的package包/類
private Warranty readWarranty(JsonReader reader) throws IOException {
    Boolean extensionEligible = false;
    String description = null;
    String expiration = null;

    reader.beginObject();
    while (reader.hasNext()) {
        String name = reader.nextName();
        if (name.equals("ExtensionEligible")) {
            extensionEligible = reader.nextBoolean();
        } else if (name.equals("Description")) {
            description = reader.nextString();
        } else if (name.equals("EndDate")) {
            expiration = reader.nextString();
        } else {
            reader.skipValue();
        }
    }
    reader.endObject();

    return new Warranty(extensionEligible, description, expiration);
}
 
開發者ID:SocketMobile,項目名稱:samples-android,代碼行數:23,代碼來源:RegistrationApiResponse.java

示例14: readJson

import android.util.JsonReader; //導入方法依賴的package包/類
@Override
public void readJson(JsonReader reader) throws IOException {
    reader.beginObject();
    while (reader.hasNext()) {
        String name = reader.nextName();

        switch (name) {
            case FIELD_ID:
                this.id = reader.nextString();
                break;
            case FIELD_NAME:
                this.name = reader.nextString();
                break;
            case FIELD_COMMENT:
                reader.skipValue();
                break;
            default:
                if (Log.isLoggable(TAG, Log.WARN)) {
                    Log.w(TAG, "Unknown rider key: " + name);
                }
                reader.skipValue();
                break;
        }
    }
    reader.endObject();
}
 
開發者ID:rschnapp,項目名稱:BusMan,代碼行數:27,代碼來源:ConfigureTagActivity.java

示例15: parse

import android.util.JsonReader; //導入方法依賴的package包/類
public SMSMessage parse() throws IOException {
    JsonReader jsonReader = new JsonReader(new StringReader(jsonString));

    String recipient = null;
    String message = null;

    jsonReader.beginObject();
    while (jsonReader.hasNext()) {
        String attributeName = jsonReader.nextName();
        if (attributeName.equals("sender_recipient")) {
            recipient = jsonReader.nextString();
        } else if (attributeName.equals("text")) {
            message = jsonReader.nextString();
        } else {
            jsonReader.skipValue();
        }
    }
    jsonReader.endObject();

    return new SMSMessage(recipient, message);
}
 
開發者ID:nerdinand,項目名稱:SMSGateway,代碼行數:22,代碼來源:JSONParser.java


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