public EstimatedHistogram deserialize(DataInputPlus in) throws IOException { int size = in.readInt(); long[] offsets = new long[size - 1]; long[] buckets = new long[size]; for (int i = 0; i < size; i++) { offsets[i == 0 ? 0 : i - 1] = in.readLong(); buckets[i] = in.readLong(); } return new EstimatedHistogram(offsets, buckets); }
public Batch deserialize(DataInputPlus in, int version) throws IOException { UUID id = UUIDSerializer.serializer.deserialize(in, version); long creationTime = in.readLong(); /* * If version doesn't match the current one, we cannot not just read the encoded mutations verbatim, * so we decode them instead, to deal with compatibility. */ return version == MessagingService.current_version ? createRemote(id, creationTime, readEncodedMutations(in)) : createLocal(id, creationTime, decodeMutations(in, version)); }