/** * {@inheritDoc} */ @Override protected void postSerializeCustomOperation(byte[] myBytes) throws PacketException { String field = CHECKSUM; try { HeaderField entry = HEADER_FORMAT.get(field); int off = getFieldOffset(field, entry); int nbits = getFieldNumBits(field, entry); byte[] cksum = toBytes(computeChecksum(myBytes, 0)); ByteUtils.setBits(myBytes, cksum, off, nbits); getHeaderFieldMap().put(CHECKSUM, cksum); } catch (RuntimeException e) { throw new PacketException("Failed to update checksum.", e); } }
int nbits = getFieldNumBits(field, hent); try { ByteUtils.setBits(packetBytes, fieldBytes, off, nbits); } catch (RuntimeException e) { String msg = "Failed to serialize field: " + field +