private void _putString(String name, String s, byte type) { _put(type, name); _putValueString(s); }
private void putMap(String name, Map m) { this._put(3, name); int sizePos = this._buf.getPosition(); this._buf.writeInt(0); Iterator var4 = m.entrySet().iterator(); while(var4.hasNext()) { Entry entry = (Entry)var4.next(); this._putObjectField(entry.getKey().toString(), entry.getValue()); } this._buf.write(0); this._buf.writeInt(sizePos, this._buf.getPosition() - sizePos); }
private void putMap(String name, Map m) { _put(OBJECT, name); final int sizePos = _buf.getPosition(); _buf.writeInt(0); for (Map.Entry entry : (Set<Map.Entry>) m.entrySet()) _putObjectField(entry.getKey().toString(), entry.getValue()); _buf.write(EOO); _buf.writeInt(sizePos, _buf.getPosition() - sizePos); }
private void _putString(String name, String s, int type) { this._put(type, name); this._putValueString(s); }
/** * Encodes the type and key. * */ protected void _put(byte type, String name) { _buf.write(type); _put(name); }
private void putArray(String name, Object array) { _put(ARRAY, name); final int sizePos = _buf.getPosition(); _buf.writeInt(0); int size = Array.getLength(array); for (int i = 0; i < size; i++) _putObjectField(String.valueOf(i), Array.get(array, i)); _buf.write(EOO); _buf.writeInt(sizePos, _buf.getPosition() - sizePos); }
protected void putCode(String name, Code code) { this._put(13, name); int temp = this._buf.getPosition(); this._putValueString(code.getCode()); }
protected void putUUID(String name, UUID val) { this._put(5, name); this._buf.writeInt(16); this._buf.write(3); this._buf.writeLong(val.getMostSignificantBits()); this._buf.writeLong(val.getLeastSignificantBits()); }
private void putArray(String name, Object array) { this._put(4, name); int sizePos = this._buf.getPosition(); this._buf.writeInt(0); int size = Array.getLength(array); for(int i = 0; i < size; ++i) { this._putObjectField(String.valueOf(i), Array.get(array, i)); } this._buf.write(0); this._buf.writeInt(sizePos, this._buf.getPosition() - sizePos); }
protected void putCode(String name, Code code) { _put(CODE, name); int temp = _buf.getPosition(); _putValueString(code.getCode()); }
protected void putUUID(String name, UUID val) { _put(BINARY, name); _buf.writeInt(16); _buf.write(B_UUID); _buf.writeLong(val.getMostSignificantBits()); _buf.writeLong(val.getLeastSignificantBits()); }
private void putIterable(String name, Iterable l) { _put(ARRAY, name); final int sizePos = _buf.getPosition(); _buf.writeInt(0); int i = 0; for (Object obj : l) { _putObjectField(String.valueOf(i), obj); i++; } _buf.write(EOO); _buf.writeInt(sizePos, _buf.getPosition() - sizePos); }
protected void putCodeWScope(String name, CodeWScope code) { _put(CODE_W_SCOPE, name); int temp = _buf.getPosition(); _buf.writeInt(0); _putValueString(code.getCode()); putObject(code.getScope()); _buf.writeInt(temp, _buf.getPosition() - temp); }
protected void _putValueString(String s) { int lenPos = _buf.getPosition(); _buf.writeInt(0); // making space for size int strLen = _put(s); _buf.writeInt(lenPos, strLen); }
private void putPattern(String name, Pattern p) { this._put(11, name); this._buf.writeCString(p.pattern()); this._buf.writeCString(BSON.regexFlags(p.flags())); }
protected void putTimestamp(String name, BSONTimestamp ts) { _put(TIMESTAMP, name); _buf.writeInt(ts.getInc()); _buf.writeInt(ts.getTime()); }
protected void putTimestamp(String name, BSONTimestamp ts) { this._put(17, name); this._buf.writeInt(ts.getInc()); this._buf.writeInt(ts.getTime()); }
protected void putObjectId(String name, ObjectId oid) { _put(OID, name); // according to spec, values should be stored big endian _buf.writeIntBE(oid._time()); _buf.writeIntBE(oid._machine()); _buf.writeIntBE(oid._inc()); }
protected void putObjectId(String name, ObjectId oid) { this._put(7, name); this._buf.writeIntBE(oid._time()); this._buf.writeIntBE(oid._machine()); this._buf.writeIntBE(oid._inc()); }