public int GetMetadataLength()
{
if (this._streamId <= byte.MaxValue)
this._slen = 0x00;
else if (this._streamId <= ushort.MaxValue)
this._slen = 0x01;
else if (this._streamId <= 16777215)
this._slen = 0x02;
else
this._slen = 0x03;
if (this._offset == 0)
this._olen = 0x00;
else if (this._offset < 65536) // 16 bits
this._olen = 0x01;
else if (this._offset < 16777216) // 24 bits
this._olen = 0x02;
else if (this._offset < 4294967296) // 32 bits
this._olen = 0x03;
else if (this._offset < 1099511627776) // 40 bits
this._olen = 0x04;
else if (this._offset < 281474976710656) // 48 bits
this._olen = 0x05;
else if (this._offset < 72057594037927936) // 56 bits
this._olen = 0x06;
else // 64 bits
this._olen = 0x07;
// INFO: We're going to just always send data length (+2)
this._metadataLength = 1 + (this._slen.Value + 1) * 8 + (this._olen.Value == 0 ? 0 : (this._olen.Value + 1) * 8) + 2;
return this._metadataLength.Value;
}