/** * Generate a representation of the headers as a series of bytes. * * @return the byte array containing the headers */ public byte[] toByteArray() throws MessagingException{ ByteArrayOutputStream headersBytes = new ByteArrayOutputStream(); writeTo(headersBytes); return headersBytes.toByteArray(); }