protected void string (String name, String value) { addChild(name, new JsonValue(value)); }
protected void number (String name, long value, String stringValue) { addChild(name, new JsonValue(value, stringValue)); }
protected void string (String name, String value) { addChild(name, new JsonValue(value)); }
protected void bool (String name, boolean value) { addChild(name, new JsonValue(value)); }
protected void number (String name, long value, String stringValue) { addChild(name, new JsonValue(value, stringValue)); }
protected void bool (String name, boolean value) { addChild(name, new JsonValue(value)); }
protected void number (String name, double value, String stringValue) { addChild(name, new JsonValue(value, stringValue)); }
protected void number (String name, double value, String stringValue) { addChild(name, new JsonValue(value, stringValue)); }
return parseObject(din); else if (type == 'Z') return new JsonValue(JsonValue.ValueType.nullValue); else if (type == 'T') return new JsonValue(true); else if (type == 'F') return new JsonValue(false); else if (type == 'B') return new JsonValue((long)readUChar(din)); else if (type == 'U') return new JsonValue((long)readUChar(din)); else if (type == 'i') return new JsonValue(oldFormat ? (long)din.readShort() : (long)din.readByte()); else if (type == 'I') return new JsonValue(oldFormat ? (long)din.readInt() : (long)din.readShort()); else if (type == 'l') return new JsonValue((long)din.readInt()); else if (type == 'L') return new JsonValue(din.readLong()); else if (type == 'd') return new JsonValue(din.readFloat()); else if (type == 'D') return new JsonValue(din.readDouble()); else if (type == 's' || type == 'S') return new JsonValue(parseString(din, type)); else if (type == 'a' || type == 'A') return parseData(din, type); else if (type == 'C') return new JsonValue(din.readChar());
return parseObject(din); else if (type == 'Z') return new JsonValue(JsonValue.ValueType.nullValue); else if (type == 'T') return new JsonValue(true); else if (type == 'F') return new JsonValue(false); else if (type == 'B') return new JsonValue((long)readUChar(din)); else if (type == 'U') return new JsonValue((long)readUChar(din)); else if (type == 'i') return new JsonValue(oldFormat ? (long)din.readShort() : (long)din.readByte()); else if (type == 'I') return new JsonValue(oldFormat ? (long)din.readInt() : (long)din.readShort()); else if (type == 'l') return new JsonValue((long)din.readInt()); else if (type == 'L') return new JsonValue(din.readLong()); else if (type == 'd') return new JsonValue(din.readFloat()); else if (type == 'D') return new JsonValue(din.readDouble()); else if (type == 's' || type == 'S') return new JsonValue(parseString(din, type)); else if (type == 'a' || type == 'A') return parseData(din, type); else if (type == 'C') return new JsonValue(din.readChar());
protected void startArray (String name) { JsonValue value = new JsonValue(ValueType.array); if (current != null) addChild(name, value); elements.add(value); current = value; }
protected void startArray (String name) { JsonValue value = new JsonValue(ValueType.array); if (current != null) addChild(name, value); elements.add(value); current = value; }
protected void startObject (String name) { JsonValue value = new JsonValue(ValueType.object); if (current != null) addChild(name, value); elements.add(value); current = value; }
protected void startObject (String name) { JsonValue value = new JsonValue(ValueType.object); if (current != null) addChild(name, value); elements.add(value); current = value; }
protected JsonValue parseArray (final DataInputStream din) throws IOException { JsonValue result = new JsonValue(JsonValue.ValueType.array); byte type = din.readByte(); byte valueType = 0;
protected JsonValue parseArray (final DataInputStream din) throws IOException { JsonValue result = new JsonValue(JsonValue.ValueType.array); byte type = din.readByte(); byte valueType = 0;
protected JsonValue parseObject (final DataInputStream din) throws IOException { JsonValue result = new JsonValue(JsonValue.ValueType.object); byte type = din.readByte(); byte valueType = 0;
protected JsonValue parseData (final DataInputStream din, final byte blockType) throws IOException { // FIXME: a/A is currently not following the specs because it lacks strong typed, fixed sized containers, // see: https://github.com/thebuzzmedia/universal-binary-json/issues/27 final byte dataType = din.readByte(); final long size = blockType == 'A' ? readUInt(din) : (long)readUChar(din); final JsonValue result = new JsonValue(JsonValue.ValueType.array); JsonValue prev = null; for (long i = 0; i < size; i++) { final JsonValue val = parse(din, dataType); val.parent = result; if (prev != null) { prev.next = val; result.size++; } else { result.child = val; result.size = 1; } prev = val; } return result; }
protected JsonValue parseData (final DataInputStream din, final byte blockType) throws IOException { // FIXME: a/A is currently not following the specs because it lacks strong typed, fixed sized containers, // see: https://github.com/thebuzzmedia/universal-binary-json/issues/27 final byte dataType = din.readByte(); final long size = blockType == 'A' ? readUInt(din) : (long)readUChar(din); final JsonValue result = new JsonValue(JsonValue.ValueType.array); JsonValue prev = null; for (long i = 0; i < size; i++) { final JsonValue val = parse(din, dataType); val.parent = result; if (prev != null) { prev.next = val; result.size++; } else { result.child = val; result.size = 1; } prev = val; } return result; }
protected JsonValue parseObject (final DataInputStream din) throws IOException { JsonValue result = new JsonValue(JsonValue.ValueType.object); byte type = din.readByte(); byte valueType = 0;