/// <summary> /// Converts data to a byte buffer. The first two bytes contain the size of this simple bloom filter. Thus, the bloom filter can only be of length 65536. /// </summary> /// <param name="buffer"></param> public void ToByteBuffer(AlternativeCompositeByteBuf buffer) { sbyte[] tmp = BitArray.ToByteArray(); int currentByteArraySize = tmp.Length; buffer.WriteShort((short)(_byteArraySize + SizeHeader)); buffer.WriteInt(ExpectedElements); buffer.WriteBytes(tmp); buffer.WriteZero(_byteArraySize - currentByteArraySize); }