public Message getMessage(Integer version) throws IOException { DataOutputBuffer dob = new DataOutputBuffer(); serializer.serialize(this, dob, version); return new Message( FBUtilities.getBroadcastAddress(), StorageService.Verb.RANGE_SLICE, Arrays.copyOf(dob.getData(), dob.getLength()), version); }
public static RangeSliceCommand read(Message message) throws IOException { byte[] bytes = message.getMessageBody(); FastByteArrayInputStream bis = new FastByteArrayInputStream(bytes); return serializer.deserialize(new DataInputStream(bis), message.getVersion()); }