Dart DocumentationbsonBsonCode

BsonCode class

class BsonCode extends BsonString{
 get value=>this;
 int get typeByte => _BSON_DATA_CODE;
 BsonCode(String dataValue):super(dataValue);
 String toString()=>"BsonCode('$data')";
}

Extends

BsonObject > BsonString > BsonCode

Constructors

new BsonCode(String dataValue) #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
BsonCode(String dataValue):super(dataValue);

Properties

String data #

inherited from BsonString
String data

final int typeByte #

int get typeByte => _BSON_DATA_CODE;

final List<int> utfData #

inherited from BsonString
List<int> get utfData{
 if (_utfData == null){
   _utfData = UTF8.encode(data);
 }
 return _utfData;
}

final value #

get value=>this;

Methods

dynamic byteLength() #

inherited from BsonString
byteLength()=>utfData.length+1+4;

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) #

inherited from BsonString
packValue(BsonBinary buffer){
  buffer.writeInt(utfData.length+1);
  buffer.byteList.setRange(buffer.offset,buffer.offset+utfData.length,utfData);
  buffer.offset += utfData.length;
  buffer.writeByte(0);
}

String toString() #

Returns a string representation of this object.

docs inherited from Object
String toString()=>"BsonCode('$data')";

_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;
}