/// <exception cref="VPackException"/> private void parseArray(VPackSlice value, java.lang.StringBuilder json, bool includeNullValues) { json.Append(ARRAY_OPEN); int added = 0; for (int i = 0; i < value.getLength(); i++) { VPackSlice valueAt = value.get(i); if (!valueAt.isNull() || includeNullValues) { if (added++ > 0) { json.Append(SEPARATOR); } this.parse(value, null, valueAt, json, includeNullValues); } } json.Append(ARRAY_CLOSE); }
/// <exception cref="VPackException"/> private void parseObject(VPackSlice value, java.lang.StringBuilder json, bool includeNullValues) { json.Append(OBJECT_OPEN); int added = 0; for (System.Collections.Generic.IEnumerator <KeyValuePair <string, VPackSlice> > iterator = value.objectIterator(); iterator.MoveNext();) { System.Collections.Generic.KeyValuePair <string, VPackSlice > next = iterator.Current; VPackSlice nextValue = next.Value; if (!nextValue.isNull() || includeNullValues) { if (added++ > 0) { json.Append(SEPARATOR); } this.parse(value, next.Key, nextValue, json, includeNullValues); } } json.Append(OBJECT_CLOSE); }
/// <exception cref="VPackException"/> public void deserialize(VPackSlice parent, string attribute , VPackSlice vpack, java.lang.StringBuilder json) { string id; long idLong = NumberUtil.toLong(vpack.getBuffer (), vpack.getStart() + 1, vpack.getByteSize() - 1); string collectionName = this.cache.getCollectionName(idLong); if (collectionName != null) { VPackSlice key = parent.get("_key"); id = string.format("%s/%s", collectionName, key.getAsString()); } else { id = null; } json.Append(org.json.simple.JSONValue.toJSONString(id)); }
/// <exception cref="System.IO.IOException"/> public static string ReadString(java.io.DataInputStream datainputstream, int i) { short word0 = datainputstream.ReadShort(); if (word0 > i) { throw new System.IO.IOException((new java.lang.StringBuilder()).Append("Received string length longer than maximum allowed (" ).Append(word0).Append(" > ").Append(i).Append(")").ToString()); } if (word0 < 0) { throw new System.IO.IOException("Received string length is less than zero! Weird string!" ); } java.lang.StringBuilder stringbuilder = new java.lang.StringBuilder(); for (int j = 0; j < word0; j++) { stringbuilder.Append(datainputstream.ReadChar()); } return(stringbuilder.ToString()); }
public override string ToString() { java.lang.StringBuilder sb = new java.lang.StringBuilder(); sb.Append("BaseDocument [documentRevision="); sb.Append(this.revision); sb.Append(", documentHandle="); sb.Append(this.id); sb.Append(", documentKey="); sb.Append(this.key); sb.Append(", from="); sb.Append(this.@from); sb.Append(", to="); sb.Append(this.to); sb.Append(", properties="); sb.Append(this.properties); sb.Append("]"); return(sb.ToString()); }
private static void appendField(string attribute, java.lang.StringBuilder json) { json.Append(org.json.simple.JSONValue.toJSONString(attribute)); json.Append(FIELD); }
/// <exception cref="VPackException"/> private void parse(VPackSlice parent, string attribute, VPackSlice value, java.lang.StringBuilder json, bool includeNullValues) { VPackJsonDeserializer deserializer = null; if (attribute != null) { appendField(attribute, json); deserializer = this.getDeserializer(attribute, value.type()); } if (deserializer != null) { deserializer.deserialize(parent, attribute, value, json); } else { if (value.isObject()) { this.parseObject(value, json, includeNullValues); } else { if (value.isArray()) { this.parseArray(value, json, includeNullValues); } else { if (value.isBoolean()) { json.Append(value.getAsBoolean()); } else { if (value.isString()) { json.Append(org.json.simple.JSONValue.toJSONString(value.getAsString())); } else { if (value.isNumber()) { json.Append(value.getAsNumber()); } else { if (value.isNull()) { json.Append(NULL); } else { json.Append(org.json.simple.JSONValue.toJSONString(NON_REPRESENTABLE_TYPE)); } } } } } } } }