public static byte[] BuildRowPutChangeWithHeader(RowPutChange rowChange) { List <PlainBufferCell> pkCells = new List <PlainBufferCell>(); if (rowChange.GetPrimaryKey() == null) { throw new ArgumentException("Primary Key is NULL"); } foreach (PrimaryKeyColumn column in rowChange.GetPrimaryKey().GetPrimaryKeyColumns()) { pkCells.Add(PlainBufferConversion.ToPlainBufferCell(column)); } List <PlainBufferCell> cells = new List <PlainBufferCell>(); foreach (Column column in rowChange.GetColumnsToPut()) { cells.Add(PlainBufferConversion.ToPlainBufferCell(column, false, false, false, (byte)0x0)); } PlainBufferRow row = new PlainBufferRow(pkCells, cells, false); int size = ComputePlainBufferRowWithHeader(row); PlainBufferOutputStream output = new PlainBufferOutputStream(size); PlainBufferCodedOutputStream codedOutput = new PlainBufferCodedOutputStream(output); codedOutput.WriteRowWithHeader(row); if (!output.IsFull()) { throw new IOException("Bug: serialize row put change failed. Buffer remains " + output.Remain()); } return(output.GetBuffer()); }
public static byte[] BuildColumnValueWithoutLengthPrefix(ColumnValue value) { int size = ComputeColumnValueWithoutLengthPrefix(value); PlainBufferOutputStream output = new PlainBufferOutputStream(size); PlainBufferCodedOutputStream codedOutput = new PlainBufferCodedOutputStream(output); codedOutput.WriteColumnValueWithoutLengthPrefix(value); if (!output.IsFull()) { throw new IOException("Bug: serialize column value failed. Buffer remains " + output.Remain()); } return(output.GetBuffer()); }