protected void writeField(final AbstractBinaryOutputStream bos) throws IOException, ImagingException {
        bos.write2Bytes(tag);
        bos.write2Bytes(abstractFieldType.getType());
        bos.write4Bytes(count);

        if (isLocalValue()) {
            if (separateValueItem != null) {
                throw new ImagingException("Unexpected separate value item.");
            }
            if (bytes.length > 4) {
                throw new ImagingException("Local value has invalid length: " + bytes.length);
            }

            bos.write(bytes);
            final int remainder = ENTRY_MAX_VALUE_LENGTH - bytes.length;
            for (int i = 0; i < remainder; i++) {
                bos.write(0);
            }
        } else {
            if (separateValueItem == null) {
                throw new ImagingException("Missing separate value item.");
            }

            bos.write4Bytes((int) separateValueItem.getOffset());
        }
    }
Set the data for this TIFF output field.

@param bytes TIFF output field data.
@throws ImagingException if the length of the bytes array do not match.
src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java