class SPUD extends BasePacket {

    @Override
    public IPacket deserialize(byte[] data, int offset, int length)
            throws PacketParsingException {
        ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
        byte[] magicConstant = new byte[MAGIC_CONSTANT.length];
        bb.get(magicConstant, 0, MAGIC_CONSTANT.length);
        if (!Arrays.equals(magicConstant, MAGIC_CONSTANT)) {
            throw new PacketParsingException("Magic constant is incorrect.");
        }
        tubeID = bb.getLong();
        byte lastByte = bb.get();
        command = (byte) ((lastByte & 0xc0) >>> 6);
        adec = ((lastByte & 0x20) != 0);
        pdec = ((lastByte & 0x10) != 0);
        reserved = (byte) (lastByte & 0xF);
        // TODO: make sure reserved bits are 0 for this version.
        this.payload = new Data();
        this.payload = payload.deserialize(data, bb.position(), bb.limit()-bb.position());
        this.payload.setParent(this);
        return this;
    }

}