BsonCString class
class BsonCString extends BsonString{ bool useKeyCash; int get typeByte{ throw "Function typeByte of BsonCString must not be called"; } BsonCString(String data, [this.useKeyCash = true]): super(data); List<int> get utfData{ if (useKeyCash){ return _Statics.getKeyUtf8(data); } else { return super.utfData; } } byteLength()=>utfData.length+1; packValue(BsonBinary buffer){ buffer.byteList.setRange(buffer.offset,buffer.offset+utfData.length,utfData); buffer.offset += utfData.length; buffer.writeByte(0); } }
Extends
BsonObject > BsonString > BsonCString
Properties
final int typeByte #
int get typeByte{ throw "Function typeByte of BsonCString must not be called"; }
Methods
dynamic byteLength() #
byteLength()=>utfData.length+1;
dynamic packElement(String name, buffer) #
inherited from BsonObject
packElement(String name, var buffer){ buffer.writeByte(typeByte); if (name != null){ new BsonCString(name).packValue(buffer); } packValue(buffer); }
dynamic packValue(BsonBinary buffer) #
packValue(BsonBinary buffer){ buffer.byteList.setRange(buffer.offset,buffer.offset+utfData.length,utfData); buffer.offset += utfData.length; buffer.writeByte(0); }
_ElementPair unpackElement(buffer) #
inherited from BsonObject
_ElementPair unpackElement(buffer){ _ElementPair result = new _ElementPair(); result.name = buffer.readCString(); unpackValue(buffer); result.value = value; return result; }
dynamic unpackValue(BsonBinary buffer) #
inherited from BsonString
unpackValue(BsonBinary buffer){ int size = buffer.readInt32()-1; data = UTF8.decode(buffer.byteList.getRange(buffer.offset, buffer.offset+size).toList()); buffer.offset += size+1; }