@Override
    public void writeItem(final AbstractBinaryOutputStream bos) throws IOException, ImagingException {
        // Write Directory Field Count
        bos.write2Bytes(fields.size()); // DirectoryFieldCount

        // Write Fields
        for (final TiffOutputField field : fields) {
            field.writeField(bos);

            // Debug.debug("\t" + "writing field (" + field.tag + ", 0x" +
            // Integer.toHexString(field.tag) + ")", field.tagInfo);
            // if (field.tagInfo.isOffset())
            // Debug.debug("\t\tOFFSET!", field.bytes);
        }

        long nextDirectoryOffset = 0;
        if (nextDirectory != null) {
            nextDirectoryOffset = nextDirectory.getOffset();
        }

        // Write nextDirectoryOffset
        if (nextDirectoryOffset == UNDEFINED_VALUE) {
            bos.write4Bytes(0);
        } else {
            bos.write4Bytes((int) nextDirectoryOffset);
        }
    }
Finds the TiffOutputField for the given TagInfo from this TiffOutputDirectory.

<p>
If there is no field matching the given TagInfo, null will be returned.
</p>

@param tagInfo the TagInfo specifying the field
@return the field matching tagInfo or null, if the field isn't present
@see #findField(int)
src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java