private GTRecord deserializeGTRecord(ByteBuffer in, GTInfo sInfo) { int colLength = BytesUtil.readVInt(in); ByteArray[] sCols = new ByteArray[colLength]; for (int i = 0; i < colLength; i++) { sCols[i] = ByteArray.importData(in); } return new GTRecord(sInfo, sCols); }
// touch every byte of the cell so that the cost of scanning will be truly reflected private int lookAndForget(IGTScanner scanner) { byte meaninglessByte = 0; int scanned = 0; for (GTRecord gtRecord : scanner) { scanned++; for (ByteArray col : gtRecord.getInternal()) { if (col != null) { int endIndex = col.offset() + col.length(); for (int i = col.offset(); i < endIndex; ++i) { meaninglessByte += col.array()[i]; } } } } System.out.println("Meaningless byte is " + meaninglessByte); IOUtils.closeQuietly(scanner); return scanned; }
private void serializeGTRecord(GTRecord gtRecord, ByteBuffer out) { BytesUtil.writeVInt(gtRecord.cols.length, out); for (ByteArray col : gtRecord.cols) { col.exportData(out); } }