public byte[] toByteArray(){
  if (headerNonce_ == null || headerTag_ == null) {
    throw new AwsCryptoException("Header nonce and tag cannot be null.");
  }
  final byte[] serializedFields=serializeAuthenticatedFields();
  final int outLen=serializedFields.length + headerNonce_.length + headerTag_.length;
  final ByteBuffer serializedBytes=ByteBuffer.allocate(outLen);
  serializedBytes.put(serializedFields);
  serializedBytes.put(headerNonce_);
  serializedBytes.put(headerTag_);
  return serializedBytes.array();
}

public byte [ ] toByteArray ( ) { if ( headerNonce_ == null || headerTag_ == null ) { throw new AwsCryptoException ( "Header nonce and tag cannot be null." ) ; } final byte [ ] serializedFields = serializeAuthenticatedFields ( ) ; final int outLen = serializedFields . length + headerNonce_ . length + headerTag_ . length ; final ByteBuffer serializedBytes = ByteBuffer . allocate ( outLen ) ; serializedBytes . put ( serializedFields ) ; serializedBytes . put ( headerNonce_ ) ; serializedBytes . put ( headerTag_ ) ; return serializedBytes . array ( ) ; }
serialize the header fields into a byte array . this method serializes all the header fields including the header nonce and tag .
