me.edwards.des.net.packet
Class PacketBlock

java.lang.Object
  extended by me.edwards.des.net.packet.Packet
      extended by me.edwards.des.net.packet.PacketBlock

public class PacketBlock
extends Packet

Block Packet

This packet is used to transfer Block data between Nodes.

Created on: Nov 3, 2015 at 10:28:29 AM

Author:
Matthew Edwards

Nested Class Summary
 
Nested classes/interfaces inherited from class me.edwards.des.net.packet.Packet
Packet.PacketTypes
 
Field Summary
private  Block block
           
 
Constructor Summary
PacketBlock(Block block)
          Creates new PacketBlock
PacketBlock(byte[] binary)
          Creates new PacketBlock from binary data
 
Method Summary
 byte[] getBinary()
          Returns the binary payload of this Packet as a byte array.
 Block getBlock()
          Returns the Block transferred by this Packet
 
Methods inherited from class me.edwards.des.net.packet.Packet
getID, lookup, toHex, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

block

private Block block
Constructor Detail

PacketBlock

public PacketBlock(Block block)
Creates new PacketBlock

Parameters:
block - Block payload

PacketBlock

public PacketBlock(byte[] binary)
Creates new PacketBlock from binary data

Parameters:
binary - Packet binary data as byte array
Method Detail

getBlock

public Block getBlock()
Returns the Block transferred by this Packet

Returns:
Block payload

getBinary

public byte[] getBinary()
Description copied from class: Packet
Returns the binary payload of this Packet as a byte array.

Specified by:
getBinary in class Packet
Returns:
Binary payload as a byte array