コード例 #1
0
 public static RangeSliceReply read(byte[] body, int version) throws IOException {
   ByteArrayInputStream bufIn = new ByteArrayInputStream(body);
   DataInputStream dis = new DataInputStream(bufIn);
   int rowCount = dis.readInt();
   List<Row> rows = new ArrayList<Row>(rowCount);
   for (int i = 0; i < rowCount; i++) {
     rows.add(Row.serializer().deserialize(dis, version));
   }
   return new RangeSliceReply(rows);
 }
コード例 #2
0
 public Message getReply(Message originalMessage) throws IOException {
   DataOutputBuffer dob = new DataOutputBuffer();
   dob.writeInt(rows.size());
   for (Row row : rows) {
     Row.serializer().serialize(row, dob, originalMessage.getVersion());
   }
   byte[] data = Arrays.copyOf(dob.getData(), dob.getLength());
   return originalMessage.getReply(
       GossipUtilities.getLocalAddress(), data, originalMessage.getVersion());
 }