8152966: ClassCastException when adding IFD to the TIFFDirectory before the image write
Summary: Move the private method getDirectoryAsIFD(TIFFDirectory) from the API class TIFFDirectory to a public method in the internal class TIFFIFD and replace all casts of TIFFDirectory to TIFFIFD with its invocation
Reviewed-by: prr