Ejemplo n.º 1
0
 /**
  * Creates new PacketBlock from binary data
  *
  * @param binary Packet binary data as byte array
  */
 public PacketBlock(byte[] binary) {
   super(PacketTypes.BLOCK.getID());
   ByteBuffer data = ByteBuffer.wrap(binary);
   data.position(1);
   int size = data.getInt();
   byte[] bytes = new byte[size - 5];
   data.get(bytes);
   this.block = new Block(bytes);
 }
Ejemplo n.º 2
0
 /**
  * Creates new PacketBlock
  *
  * @param block Block payload
  */
 public PacketBlock(Block block) {
   super(PacketTypes.BLOCK.getID());
   this.block = block;
 }