本文整理匯總了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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();
}
示例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);
}