/** * Returns the size of the packet in bytes. */ // TODO rename to getPacketSize // TODO override in subclasses to avoid calling toByteArray by adding field lengths public int getSize() { return toByteArray().length; }
/** * Writes the packet to an <code>OutputStream</code> in binary representation. */ public void writeTo(OutputStream outputStream) throws IOException { outputStream.write(toByteArray()); }