@Override protected byte[] asBytes(int bitsCount) { byte[] bytes = super.asBytes(bitsCount); int currentBitIndex = super.getBitsCount(); ByteUtils.addByteArrayToArrayAtByteIndex(leavingPeerInfo.asBytes(), bytes, currentBitIndex / 8); currentBitIndex += leavingPeerInfo.getBitsCount(); for (ResourceObject currentResource : resources) { ByteUtils.addByteArrayToArrayAtByteIndex( currentResource.asBytes(), bytes, currentBitIndex / 8); currentBitIndex += currentResource.getBitsCount(); } return bytes; }