Package com.drew.metadata.exif
Class ExifReader
java.lang.Object
com.drew.metadata.exif.ExifReader
- All Implemented Interfaces:
JpegSegmentMetadataReader
Decodes Exif binary data, populating a
Metadata
object with tag values in ExifSubIFDDirectory
,
ExifThumbnailDirectory
, ExifInteropDirectory
, GpsDirectory
and one of the many camera
makernote directories.-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Exif data stored in JPEG files' APP1 segment are preceded by this six character preamble "Exif\0\0". -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
extract
(RandomAccessReader reader, Metadata metadata) Reads TIFF formatted Exif data from start of the specifiedRandomAccessReader
.void
extract
(RandomAccessReader reader, Metadata metadata, int readerOffset) Reads TIFF formatted Exif data a specified offset within aRandomAccessReader
.void
extract
(RandomAccessReader reader, Metadata metadata, int readerOffset, Directory parentDirectory) Reads TIFF formatted Exif data at a specified offset within aRandomAccessReader
.Gets the set of JPEG segment types that this reader is interested in.void
readJpegSegments
(Iterable<byte[]> segments, Metadata metadata, JpegSegmentType segmentType) Extracts metadata from all instances of a particular JPEG segment type.static boolean
startsWithJpegExifPreamble
(byte[] bytes) Indicates whether 'bytes' starts with 'JpegSegmentPreamble'.
-
Field Details
-
JPEG_SEGMENT_PREAMBLE
Exif data stored in JPEG files' APP1 segment are preceded by this six character preamble "Exif\0\0".- See Also:
-
-
Constructor Details
-
ExifReader
public ExifReader()
-
-
Method Details
-
getSegmentTypes
Description copied from interface:JpegSegmentMetadataReader
Gets the set of JPEG segment types that this reader is interested in.- Specified by:
getSegmentTypes
in interfaceJpegSegmentMetadataReader
-
readJpegSegments
public void readJpegSegments(Iterable<byte[]> segments, Metadata metadata, JpegSegmentType segmentType) Description copied from interface:JpegSegmentMetadataReader
Extracts metadata from all instances of a particular JPEG segment type.- Specified by:
readJpegSegments
in interfaceJpegSegmentMetadataReader
- Parameters:
segments
- A sequence of byte arrays from which the metadata should be extracted. These are in the order encountered in the original file.metadata
- TheMetadata
object into which extracted values should be merged.segmentType
- TheJpegSegmentType
being read.
-
startsWithJpegExifPreamble
public static boolean startsWithJpegExifPreamble(byte[] bytes) Indicates whether 'bytes' starts with 'JpegSegmentPreamble'. -
extract
Reads TIFF formatted Exif data from start of the specifiedRandomAccessReader
. -
extract
Reads TIFF formatted Exif data a specified offset within aRandomAccessReader
. -
extract
public void extract(RandomAccessReader reader, Metadata metadata, int readerOffset, Directory parentDirectory) Reads TIFF formatted Exif data at a specified offset within aRandomAccessReader
.
-