@Override public ByteArray deserialize(ByteBuffer in) { //the array in ByteArray is garanteed to be completed owned by the ByteArray return new ByteArray(BytesUtil.readByteArray(in)); } }
@Override public ByteArray deserialize(ByteBuffer buffer) { return new ByteArray(BytesUtil.readByteArray(buffer)); } };
public static String readUTFString(ByteBuffer in) { byte[] bytes = readByteArray(in); return bytes == null ? null : Bytes.toString(bytes); }
public static ByteArray importData(ByteBuffer in) { byte[] bytes = BytesUtil.readByteArray(in); return new ByteArray(bytes); }
public static DimensionEncoding readDimensionEncoding(ByteBuffer in) { try { int isNull = BytesUtil.readVInt(in); if (isNull == 1) { return null; } byte[] bytes = BytesUtil.readByteArray(in); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); ObjectInputStream ois = new ObjectInputStream(bais); DimensionEncoding ret = (DimensionEncoding) ois.readObject(); return ret; } catch (IOException | ClassNotFoundException e) { throw new RuntimeException(e); } }
@Override public RawScan deserialize(ByteBuffer in) { byte[] sStartKey = BytesUtil.readByteArray(in); byte[] sEndKey = BytesUtil.readByteArray(in); int hbaseColumnsSize = BytesUtil.readVInt(in); List<Pair<byte[], byte[]>> sHbaseCoumns = Lists.newArrayListWithCapacity(hbaseColumnsSize); for (int i = 0; i < hbaseColumnsSize; i++) { byte[] a = BytesUtil.readByteArray(in); byte[] b = BytesUtil.readByteArray(in); sHbaseCoumns.add(Pair.newPair(a, b)); } int fuzzyKeysSize = BytesUtil.readVInt(in); List<Pair<byte[], byte[]>> sFuzzyKeys = Lists.newArrayListWithCapacity(fuzzyKeysSize); for (int i = 0; i < fuzzyKeysSize; i++) { byte[] a = BytesUtil.readByteArray(in); byte[] b = BytesUtil.readByteArray(in); sFuzzyKeys.add(Pair.newPair(a, b)); } int sHBaseCaching = BytesUtil.readVInt(in); int sHBaseMaxResultSize = BytesUtil.readVInt(in); return new RawScan(sStartKey, sEndKey, sHbaseCoumns, sFuzzyKeys, sHBaseCaching, sHBaseMaxResultSize); } };
@Override public CoprocessorProjector deserialize(ByteBuffer in) { byte[] mask = BytesUtil.readByteArray(in); boolean hasGroupBy = BytesUtil.readVInt(in) == 1; return new CoprocessorProjector(mask, hasGroupBy); } };
@Override public ImmutableBitSet deserialize(ByteBuffer in) { BitSet bitSet = BitSet.valueOf(BytesUtil.readByteArray(in)); return new ImmutableBitSet(bitSet); } };
@Override public void deserialize(IFilterCodeSystem<?> cs, ByteBuffer buffer) { int nWhenEntries = BytesUtil.readVInt(buffer); List<Pair<TupleFilter, TupleExpression>> whenList = Lists.newArrayListWithExpectedSize(nWhenEntries); for (int i = 0; i < nWhenEntries; i++) { TupleFilter tupleFilter = TupleFilterSerializer.deserialize(BytesUtil.readByteArray(buffer), cs); TupleExpression tupleExpression = TupleExpressionSerializer.deserialize(BytesUtil.readByteArray(buffer), cs); whenList.add(new Pair<>(tupleFilter, tupleExpression)); } this.whenList = whenList; int flag = BytesUtil.readVInt(buffer); if (flag == 1) { this.elseExpr = TupleExpressionSerializer.deserialize(BytesUtil.readByteArray(buffer), cs); } }
@Override public List<ByteArray> deserialize(ByteBuffer in) { List<ByteArray> values = new ArrayList<>(); int size = BytesUtil.readVInt(in); if (size >= 0) { for (int i = 0; i < size; i++) { ByteArray ba = new ByteArray(BytesUtil.readByteArray(in)); if (ba.length() != 0) { values.add(ba); } } } else { throw new RuntimeException("Read error data size:" + size); } return values; } }
public static String readUTFString(ByteBuffer in) { byte[] bytes = readByteArray(in); return bytes == null ? null : Bytes.toString(bytes); }
TupleFilter sGTFilter = GTUtil.deserializeGTFilter(BytesUtil.readByteArray(in), sInfo); sGTHavingFilter = TupleFilterSerializer.deserialize(BytesUtil.readByteArray(in), StringCodeSystem.INSTANCE); for (int i = 0; i < nTupleExprs; i++) { int sC = BytesUtil.readVInt(in); TupleExpression sTupleExpr = TupleExpressionSerializer.deserialize(BytesUtil.readByteArray(in), GTUtil.wrap(sInfo.codeSystem.getComparator())); sTupleExpressionMap.put(sC, sTupleExpr);
@Override public CoprocessorProjector deserialize(ByteBuffer in) { byte[] mask = BytesUtil.readByteArray(in); return new CoprocessorProjector(mask); } }
@Override public ObserverAggregators deserialize(ByteBuffer in) { int nHCols = BytesUtil.readVInt(in); HCol[] hcols = new HCol[nHCols]; for (int i = 0; i < nHCols; i++) { byte[] family = BytesUtil.readByteArray(in); byte[] qualifier = BytesUtil.readByteArray(in); String[] funcNames = BytesUtil.readAsciiStringArray(in); String[] dataTypes = BytesUtil.readAsciiStringArray(in); hcols[i] = new HCol(family, qualifier, funcNames, dataTypes); } return new ObserverAggregators(hcols); }
byte[] filetrBytes = BytesUtil.readByteArray(buffer); filter.deserialize(filetrBytes);
@Override public EndpointAggregators deserialize(ByteBuffer in) { String[] funcNames = BytesUtil.readAsciiStringArray(in); String[] dataTypes = BytesUtil.readAsciiStringArray(in); int metricInfoLength = BytesUtil.readVInt(in); MetricInfo[] infos = new MetricInfo[metricInfoLength]; for (int i = 0; i < infos.length; ++i) { MetricType type = MetricType.valueOf(BytesUtil.readAsciiString(in)); int refIndex = BytesUtil.readVInt(in); int presision = BytesUtil.readVInt(in); infos[i] = new MetricInfo(type, refIndex, presision); } byte[] temp = BytesUtil.readByteArray(in); TableRecordInfoDigest tableInfo = TableRecordInfoDigest.deserialize(temp); return new EndpointAggregators(funcNames, dataTypes, infos, tableInfo); }
@Override public ByteArray deserialize(ByteBuffer buffer) { return new ByteArray(BytesUtil.readByteArray(buffer)); } };
public static ByteArray importData(ByteBuffer in) { byte[] bytes = BytesUtil.readByteArray(in); return new ByteArray(bytes); }
@Override public ImmutableBitSet deserialize(ByteBuffer in) { BitSet bitSet = BitSet.valueOf(BytesUtil.readByteArray(in)); return new ImmutableBitSet(bitSet); } };
@Override public CoprocessorProjector deserialize(ByteBuffer in) { byte[] mask = BytesUtil.readByteArray(in); boolean hasGroupBy = BytesUtil.readVInt(in) == 1; return new CoprocessorProjector(mask, hasGroupBy); } };