protected void writeSegments(final OutputStream outputStream, final List<? extends JFIFPiece> segments) throws IOException {
        try (DataOutputStream os = new DataOutputStream(outputStream)) {
            JpegConstants.SOI.writeTo(os);

            for (final JFIFPiece piece : segments) {
                piece.write(os);
            }
        }
    }
Constructs a new instance with the default, big-endian, byte order.
<p>
Whether a file contains an image based on its file extension.
</p>
src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java