private void PutLabel(int recordOffset, string label) { if (Encoding.ASCII.Equals(LabelCharset)) { int length = MetaDataBuffer.PutStringWithoutLengthAscii(recordOffset + LABEL_OFFSET + BitUtil.SIZE_OF_INT, label, 0, MAX_LABEL_LENGTH); MetaDataBuffer.PutInt(recordOffset + LABEL_OFFSET, length); } else { byte[] bytes = LabelCharset.GetBytes(label); int length = Math.Min(bytes.Length, MAX_LABEL_LENGTH); MetaDataBuffer.PutInt(recordOffset + LABEL_OFFSET, length); MetaDataBuffer.PutBytes(recordOffset + LABEL_OFFSET + BitUtil.SIZE_OF_INT, bytes, 0, length); } }