@NotNull
    public static JpegSegmentData readSegments(@NotNull File file, @Nullable Iterable<JpegSegmentType> segmentTypes) throws JpegProcessingException, IOException
    {
        FileInputStream stream = null;
        try {
            stream = new FileInputStream(file);
            return readSegments(new StreamReader(stream), segmentTypes);
        } finally {
            if (stream != null) {
                stream.close();
            }
        }
    }
@ NotNull public static JpegSegmentData readSegments ( @ NotNull File file , @ Nullable Iterable < JpegSegmentType > segmentTypes ) throws JpegProcessingException , IOException { FileInputStream stream = null ; try { stream = new FileInputStream ( file ) ; return readSegments ( new StreamReader ( stream ) , segmentTypes ) ; } finally { if ( stream != null ) { stream . close ( ) ; } } }
Processes the provided JPEG data, and extracts the specified JPEG segments into a {@link JpegSegmentData} object.
<p>
Will not return SOS (start of scan) or EOI (end of image) segments.

@param file a {@link File} from which the JPEG data will be read.
@param segmentTypes the set of JPEG segments types that are to be returned. If this argument is <code>null</code>
then all found segment types are returned.