UnsynchronizedBuffer.Reader din = new UnsynchronizedBuffer.Reader(localData); buffer = new UnsynchronizedBuffer.Writer(); for (int i = 0; i < localEntries; i++) { byte[] cq = oldReadBytes(din); byte[] cv = oldReadBytes(din); boolean hasts = din.readBoolean(); long ts = din.readLong(); boolean deleted = din.readBoolean(); int valLen = din.readInt(); } else { val = new byte[valLen]; din.readBytes(val);
public IterConfig decompress(ByteBuffer iterators) { IterConfig config = new IterConfig(); UnsynchronizedBuffer.Reader in = new UnsynchronizedBuffer.Reader(iterators); int num = in.readVInt(); for (int i = 0; i < num; i++) { String name = symbolTable.get(in.readVInt()); String iterClass = symbolTable.get(in.readVInt()); int prio = in.readVInt(); config.ssiList.add(new IterInfo(prio, iterClass, name)); int numOpts = in.readVInt(); HashMap<String,String> opts = new HashMap<>(); for (int j = 0; j < numOpts; j++) { String key = symbolTable.get(in.readVInt()); String val = symbolTable.get(in.readVInt()); opts.put(key, val); } config.ssio.put(name, opts); } return config; }
UnsynchronizedBuffer.Reader din = new UnsynchronizedBuffer.Reader(localData); buffer = new UnsynchronizedBuffer.Writer(); for (int i = 0; i < localEntries; i++) { byte[] cq = oldReadBytes(din); byte[] cv = oldReadBytes(din); boolean hasts = din.readBoolean(); long ts = din.readLong(); boolean deleted = din.readBoolean(); int valLen = din.readInt(); } else { val = new byte[valLen]; din.readBytes(val);
private ColumnUpdate deserializeColumnUpdate(UnsynchronizedBuffer.Reader in) { byte[] cf = readBytes(in); byte[] cq = readBytes(in); byte[] cv = readBytes(in); boolean hasts = in.readBoolean(); long ts = 0; if (hasts) ts = in.readVLong(); boolean deleted = in.readBoolean(); byte[] val; int valLen = (int) in.readVLong(); if (valLen < 0) { val = values.get((-1 * valLen) - 1); } else if (valLen == 0) { val = EMPTY_BYTES; } else { val = new byte[valLen]; in.readBytes(val); } return newColumnUpdate(cf, cq, cv, hasts, ts, deleted, val); }
/** * Gets the modifications and deletions in this mutation. After calling this method, further * modifications to this mutation are ignored. Changes made to the returned updates do not affect * this mutation. * * @return list of modifications and deletions */ public List<ColumnUpdate> getUpdates() { serialize(); UnsynchronizedBuffer.Reader in = new UnsynchronizedBuffer.Reader(data); if (updates == null) { if (entries == 1) { updates = Collections.singletonList(deserializeColumnUpdate(in)); } else { ColumnUpdate[] tmpUpdates = new ColumnUpdate[entries]; for (int i = 0; i < entries; i++) tmpUpdates[i] = deserializeColumnUpdate(in); updates = Arrays.asList(tmpUpdates); } } return updates; }
public IterConfig decompress(ByteBuffer iterators) { IterConfig config = new IterConfig(); UnsynchronizedBuffer.Reader in = new UnsynchronizedBuffer.Reader(iterators); int num = in.readVInt(); for (int i = 0; i < num; i++) { String name = symbolTable.get(in.readVInt()); String iterClass = symbolTable.get(in.readVInt()); int prio = in.readVInt(); config.ssiList.add(new IterInfo(prio, iterClass, name)); int numOpts = in.readVInt(); HashMap<String,String> opts = new HashMap<>(); for (int j = 0; j < numOpts; j++) { String key = symbolTable.get(in.readVInt()); String val = symbolTable.get(in.readVInt()); opts.put(key, val); } config.ssio.put(name, opts); } return config; }
/** * Reads an integer value from this reader's buffer, assuming the integer was encoded as a * variable-length list of bytes. * * @return integer value */ public int readVInt() { return (int) readVLong(); }
/** * Gets the modifications and deletions in this mutation. After calling this method, further * modifications to this mutation are ignored. Changes made to the returned updates do not affect * this mutation. * * @return list of modifications and deletions */ public List<ColumnUpdate> getUpdates() { serialize(); UnsynchronizedBuffer.Reader in = new UnsynchronizedBuffer.Reader(data); if (updates == null) { if (entries == 1) { updates = Collections.singletonList(deserializeColumnUpdate(in)); } else { ColumnUpdate[] tmpUpdates = new ColumnUpdate[entries]; for (int i = 0; i < entries; i++) tmpUpdates[i] = deserializeColumnUpdate(in); updates = Arrays.asList(tmpUpdates); } } return updates; }
private ColumnUpdate deserializeColumnUpdate(UnsynchronizedBuffer.Reader in) { byte[] cf = readBytes(in); byte[] cq = readBytes(in); byte[] cv = readBytes(in); boolean hasts = in.readBoolean(); long ts = 0; if (hasts) ts = in.readVLong(); boolean deleted = in.readBoolean(); byte[] val; int valLen = (int) in.readVLong(); if (valLen < 0) { val = values.get((-1 * valLen) - 1); } else if (valLen == 0) { val = EMPTY_BYTES; } else { val = new byte[valLen]; in.readBytes(val); } return newColumnUpdate(cf, cq, cv, hasts, ts, deleted, val); }
/** * Reads an integer value from this reader's buffer, assuming the integer was encoded as a * variable-length list of bytes. * * @return integer value */ public int readVInt() { return (int) readVLong(); }