Пример #1
0
 public MoveScribeMsg(InputBuffer buf, Endpoint endpoint) throws IOException {
   from = endpoint.readId(buf, endpoint.getId().getType());
   x = buf.readFloat();
   y = buf.readFloat();
   z = buf.readFloat();
   rw = buf.readFloat();
   rx = buf.readFloat();
   ry = buf.readFloat();
   rz = buf.readFloat();
   name = buf.readUTF();
 }
Пример #2
0
  @Test
  public void testDeserializer() throws IOException {
    InputBuffer inBuf = mock(InputBuffer.class);
    when(inBuf.readByte()).thenReturn(new Byte((byte) 0));

    Object message =
        koalaDeserializer.deserialize(
            inBuf,
            InsertRequestMessage.TYPE,
            InsertRequestMessage.DEFAULT_PRIORITY,
            mock(NodeHandle.class));

    assertTrue(message instanceof InsertRequestMessage);
  }
Пример #3
0
 /**
  * Id (Version 0) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + 160 Bit + +
  * + + + + + + + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  *
  * @param buf
  * @throws IOException
  */
 public static Id build(rice.p2p.commonapi.rawserialization.InputBuffer buf) throws IOException {
   int[] material = new int[nlen];
   for (int i = 0; i < material.length; i++) {
     material[i] = buf.readInt();
   }
   return build(material);
 }
 public boolean loadCheckpoint(InputBuffer buffer) throws IOException {
   if (buffer.readInt() != 31173) throw new RuntimeException("invalid checkpoint");
   nextSendTime = buffer.readLong();
   if (buffer.readBoolean()) {
     dest = new HandleSerializer().deserialize(buffer);
   }
   if (logger.level <= Logger.FINER) logger.log("loadCheckpoint " + nextSendTime);
   byte[] bytes = new byte[buffer.readInt()];
   buffer.read(bytes);
   ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
   try {
     rand = (Random) new ObjectInputStream(bais).readObject();
   } catch (ClassNotFoundException cnfe) {
     IOException ioe = new IOException("Error reading random number from checkpoint");
     ioe.initCause(cnfe);
     throw ioe;
   }
   if (nextSendTime > 0) {
     scheduleMessageToBeSent(nextSendTime, true);
   }
   return true;
 }
Пример #5
0
 /**
  * Protected because it should only be called from an extending class, to get version numbers
  * correct.
  */
 protected ScribeMessage(InputBuffer buf, Endpoint endpoint) throws IOException {
   if (buf.readBoolean()) source = endpoint.readNodeHandle(buf);
   topic = new Topic(buf, endpoint);
 }
 public static IdImpl build(InputBuffer buf) throws IOException {
   return new IdImpl(buf.readInt());
 }
 public static HandleImpl build(InputBuffer buf) throws IOException {
   return new HandleImpl(buf.readUTF(), IdImpl.build(buf));
 }