@Test public void testBooleanArray() { ByteBuffer buffer = ByteBuffer.allocate(10000); boolean[] x = new boolean[] { true, false, true }; BytesUtil.writeBooleanArray(x, buffer); buffer.flip(); boolean[] y = BytesUtil.readBooleanArray(buffer); assertEquals(y[2], true); assertEquals(y[1], false); }
@Test public void testBooleanArray() { ByteBuffer buffer = ByteBuffer.allocate(10000); boolean[] x = new boolean[] { true, false, true }; BytesUtil.writeBooleanArray(x, buffer); buffer.flip(); boolean[] y = BytesUtil.readBooleanArray(buffer); assertEquals(y[2], true); assertEquals(y[1], false); }
@Override public TableRecordInfoDigest deserialize(ByteBuffer in) { TableRecordInfoDigest result = new TableRecordInfoDigest(); result.nColumns = BytesUtil.readVInt(in); result.byteFormLen = BytesUtil.readVInt(in); result.offsets = BytesUtil.readIntArray(in); result.dictMaxIds = BytesUtil.readIntArray(in); result.lengths = BytesUtil.readIntArray(in); result.isMetric = BytesUtil.readBooleanArray(in); result.measureSerializers = new FixedLenMeasureCodec<?>[result.nColumns]; for (int i = 0; i < result.nColumns; ++i) { String typeStr = BytesUtil.readAsciiString(in); if (typeStr == null) { result.measureSerializers[i] = null; } else { result.measureSerializers[i] = FixedLenMeasureCodec .get(DataType.getInstance(typeStr)); } } return result; }
@Override public TableRecordInfoDigest deserialize(ByteBuffer in) { TableRecordInfoDigest result = new TableRecordInfoDigest(); result.nColumns = BytesUtil.readVInt(in); result.byteFormLen = BytesUtil.readVInt(in); result.offsets = BytesUtil.readIntArray(in); result.dictMaxIds = BytesUtil.readIntArray(in); result.lengths = BytesUtil.readIntArray(in); result.isMetric = BytesUtil.readBooleanArray(in); result.metricDataTypes = BytesUtil.readAsciiStringArray(in); return result; }