List of usage examples for android.util JsonReader nextString
public String nextString() throws IOException
From source file:com.workday.autoparse.json.parser.JsonParserUtils.java
public static Byte nextByte(JsonReader reader, String name) throws IOException { if (handleNull(reader)) { return 0; }// www .j ava 2 s . c o m assertType(reader, name, JsonToken.NUMBER, JsonToken.STRING); return Byte.valueOf(reader.nextString()); }
From source file:com.workday.autoparse.json.parser.JsonParserUtils.java
public static Long nextLong(JsonReader reader, String name) throws IOException { if (handleNull(reader)) { return 0L; }/*from w ww.j a va 2 s. c om*/ assertType(reader, name, JsonToken.NUMBER, JsonToken.STRING); return Long.valueOf(reader.nextString()); }
From source file:com.workday.autoparse.json.parser.JsonParserUtils.java
public static Short nextShort(JsonReader reader, String name) throws IOException { if (handleNull(reader)) { return 0; }//from w w w . j ava 2 s . c o m assertType(reader, name, JsonToken.NUMBER, JsonToken.STRING); return Short.valueOf(reader.nextString()); }
From source file:com.workday.autoparse.json.parser.JsonParserUtils.java
public static Float nextFloat(JsonReader reader, String name) throws IOException { if (handleNull(reader)) { return 0f; }//from ww w. j a va 2s . c o m assertType(reader, name, JsonToken.NUMBER, JsonToken.STRING); return Float.valueOf(reader.nextString()); }
From source file:com.workday.autoparse.json.parser.JsonParserUtils.java
public static Double nextDouble(JsonReader reader, String name) throws IOException { if (handleNull(reader)) { return 0d; }/*from www . j a v a2 s.co m*/ assertType(reader, name, JsonToken.NUMBER, JsonToken.STRING); return Double.valueOf(reader.nextString()); }
From source file:com.workday.autoparse.json.parser.JsonParserUtils.java
public static Integer nextInt(JsonReader reader, String name) throws IOException { if (handleNull(reader)) { return 0; }// w ww . j a v a2 s . co m assertType(reader, name, JsonToken.NUMBER, JsonToken.STRING); return Integer.valueOf(reader.nextString()); }
From source file:com.workday.autoparse.json.parser.JsonParserUtils.java
public static BigDecimal nextBigDecimal(JsonReader reader, String name) throws IOException { if (handleNull(reader)) { return BigDecimal.ZERO; }// www. j a v a 2 s. c o m assertType(reader, name, JsonToken.NUMBER, JsonToken.STRING); return new BigDecimal(reader.nextString()); }
From source file:com.workday.autoparse.json.parser.JsonParserUtils.java
public static BigInteger nextBigInteger(JsonReader reader, String name) throws IOException { if (handleNull(reader)) { return BigInteger.ZERO; }/*from www. ja v a 2 s. com*/ assertType(reader, name, JsonToken.NUMBER, JsonToken.STRING); return new BigInteger(reader.nextString()); }
From source file:com.fuzz.android.limelight.util.JSONTool.java
/** * @param reader/* w ww . java 2 s.com*/ * @return the generated Act object from the JSON * @throws IOException */ public static Act readAct(JsonReader reader) throws IOException { int id = -1; String message = null; int messageResId = -1; int graphResId = -1; boolean isActionBarItem = false; double xOffset = -1; double yOffset = -1; int textColor = -1; int textBackgroundColor = -1; float textSize = -1; boolean textBackgroundTransparent = false; String animation = null; String activityName = null; reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("id")) id = reader.nextInt(); else if (name.equals("message")) message = reader.nextString(); else if (name.equals("message_res_id")) messageResId = reader.nextInt(); else if (name.equals("graphic_res_id")) graphResId = reader.nextInt(); else if (name.equals("is_action_bar_item")) isActionBarItem = reader.nextBoolean(); else if (name.equals("x_offset")) xOffset = reader.nextDouble(); else if (name.equals("y_offset")) yOffset = reader.nextDouble(); else if (name.equals("text_color")) textColor = reader.nextInt(); else if (name.equals("text_background_color")) textBackgroundColor = reader.nextInt(); else if (name.equals("text_size")) textSize = reader.nextLong(); else if (name.equals("text_background_transparent")) textBackgroundTransparent = reader.nextBoolean(); else if (name.equals("animation")) animation = reader.nextString(); else if (name.equals("activity_name")) activityName = reader.nextString(); else reader.skipValue(); } reader.endObject(); Act act = new Act(); act.setId(id); act.setMessage(message); act.setMessageResID(messageResId); act.setGraphicResID(graphResId); act.setIsActionBarItem(isActionBarItem); act.setDisplacement(xOffset, yOffset); act.setTextColor(textColor); act.setTextBackgroundColor(textBackgroundColor); act.setTextSize(textSize); act.setTransparentBackground(textBackgroundTransparent); act.setAnimation(animation); act.setActivityName(activityName); act.getLayout(); return act; }
From source file:com.workday.autoparse.json.demo.UnannotatedObjectParser.java
private void parseFromReader(UnannotatedObject out, JsonReader reader) throws IOException { while (reader.hasNext()) { String name = reader.nextName(); switch (name) { case "string": { out.string = reader.nextString(); break; }// ww w . j av a2 s . c o m default: { reader.skipValue(); } } } }