@@ -354,22 +354,33 @@ private int moveToExifSegmentAndGetLength(Reader reader) throws IOException {
354
354
return moveToSegmentAndGetLength (reader , EXIF_SEGMENT_TYPE );
355
355
}
356
356
357
- private boolean hasJpegMpfPreamble (Reader reader , byte [] tempArray , int mpfSegmentLength )
357
+ /**
358
+ * Returns whether the reader, set at the beginning of the APP2 segment past the length bytes,
359
+ * contains multi-picture format (MPF) data.
360
+ *
361
+ * @param reader must be set at the start of an APP2 segment, past the APP2 label and length
362
+ * bytes.
363
+ * @param tempArray for storing temporary array. Must be at least the size of
364
+ * {@code app2SegmentLength}.
365
+ * @param app2SegmentLength the length of the APP2 segment.
366
+ * @throws IOException if an EOF is reached before anything was read.
367
+ */
368
+ private boolean hasJpegMpfPreamble (Reader reader , byte [] tempArray , int app2SegmentLength )
358
369
throws IOException {
359
- int read = reader .read (tempArray , mpfSegmentLength );
360
- if (read != mpfSegmentLength ) {
370
+ int read = reader .read (tempArray , app2SegmentLength );
371
+ if (read != app2SegmentLength ) {
361
372
if (Log .isLoggable (TAG , Log .DEBUG )) {
362
373
Log .d (
363
374
TAG ,
364
- "Unable to read MPF segment data"
375
+ "Unable to read APP2 segment data"
365
376
+ ", length: "
366
- + mpfSegmentLength
377
+ + app2SegmentLength
367
378
+ ", actually read: "
368
379
+ read );
369
380
}
370
381
return false ;
371
382
}
372
- return hasMatchingBytes (tempArray , mpfSegmentLength , JPEG_MPF_SEGMENT_PREAMBLE_BYTES );
383
+ return hasMatchingBytes (tempArray , app2SegmentLength , JPEG_MPF_SEGMENT_PREAMBLE_BYTES );
373
384
}
374
385
375
386
private int moveToApp2SegmentAndGetLength (Reader reader ) throws IOException {
0 commit comments