ExifReader Class Reference

Inherits com::drew::metadata::MetadataReader.

Collaboration diagram for ExifReader:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ExifReader (byte[] data)
 ExifReader (File file) throws JpegProcessingException
Metadata extract (Metadata metadata)
Metadata extract ()

Static Public Attributes

static final int TAG_EXIF_OFFSET = 0x8769
static final int TAG_GPS_INFO_OFFSET = 0x8825
static final int TAG_INTEROP_OFFSET = 0xA005
static final int TAG_MAKER_NOTE = 0x927C
static int TIFF_HEADER_START_OFFSET = 6

Static Package Attributes

static final int[] BYTES_PER_FORMAT = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8}

Private Member Functions

int calculateDirectoryEntryOffset (int ifdStartOffset, int entryNumber)
int calculateTagValueOffset (int byteCount, int dirEntryOffset)
void extractThumbnail (Directory exifDirectory)
int get16Bits (int offset)
int get32Bits (int offset)
boolean isDirectoryLengthValid (int dirStartOffset)
void processDirectory (Directory directory, int dirStartOffset)
void processMakerNote (int subdirOffset)
void processTag (Directory directory, int tagType, int tagValueOffset, int componentCount, int formatCode)
String readCommentString (int tagValueOffset, int componentCount, int formatCode)
String readString (int offset, int maxLength)
boolean setByteOrder (String byteOrderIdentifier)

Private Attributes

final byte[] _data
boolean _isMotorollaByteOrder
Metadata _metadata

Static Private Attributes

static final int FMT_BYTE = 1
static final int FMT_DOUBLE = 12
static final int FMT_SBYTE = 6
static final int FMT_SINGLE = 11
static final int FMT_SLONG = 9
static final int FMT_SRATIONAL = 10
static final int FMT_SSHORT = 8
static final int FMT_STRING = 2
static final int FMT_ULONG = 4
static final int FMT_UNDEFINED = 7
static final int FMT_URATIONAL = 5
static final int FMT_USHORT = 3
static final int MAX_FORMAT_CODE = 12


Detailed Description

Extracts Exif data from a JPEG header segment, providing information about the camera/scanner/capture device (if available). Information is encapsulated in an Metadata object.
Author:
Drew Noakes http://drewnoakes.com

Constructor & Destructor Documentation

ExifReader ( File  file  )  throws JpegProcessingException

Parameters:
file 
Exceptions:
JpegProcessingException 

ExifReader ( byte[]  data  ) 

Creates an ExifReader for the given JPEG header segment.


Member Function Documentation

int calculateDirectoryEntryOffset ( int  ifdStartOffset,
int  entryNumber 
) [private]

Determine the offset at which a given InteropArray entry begins within the specified IFD.

Parameters:
ifdStartOffset the offset at which the IFD starts
entryNumber the zero-based entry number

int calculateTagValueOffset ( int  byteCount,
int  dirEntryOffset 
) [private]

Metadata extract ( Metadata  metadata  ) 

Performs the Exif data extraction, adding found values to the specified instance of Metadata.

Implements MetadataReader.

Metadata extract (  ) 

Performs the Exif data extraction, returning a new instance of Metadata.

Implements MetadataReader.

void extractThumbnail ( Directory  exifDirectory  )  [private]

int get16Bits ( int  offset  )  [private]

Get a 16 bit value from file's native byte order. Between 0x0000 and 0xFFFF.

int get32Bits ( int  offset  )  [private]

Get a 32 bit value from file's native byte order.

boolean isDirectoryLengthValid ( int  dirStartOffset  )  [private]

void processDirectory ( Directory  directory,
int  dirStartOffset 
) [private]

Process one of the nested Tiff IFD directories. 2 bytes: number of tags for each tag 2 bytes: tag type 2 bytes: format code 4 bytes: component count

void processMakerNote ( int  subdirOffset  )  [private]

void processTag ( Directory  directory,
int  tagType,
int  tagValueOffset,
int  componentCount,
int  formatCode 
) [private]

String readCommentString ( int  tagValueOffset,
int  componentCount,
int  formatCode 
) [private]

A special case of readString that handle Exif UserComment reading. This method is necessary as certain camere models prefix the comment string with "ASCII\0", which is all that would be returned by readString(...).

String readString ( int  offset,
int  maxLength 
) [private]

Creates a String from the _data buffer starting at the specified offset, and ending where byte=='' or where length==maxLength.

boolean setByteOrder ( String  byteOrderIdentifier  )  [private]


Member Data Documentation

final byte [] _data [private]

The JPEG segment as an array of bytes.

boolean _isMotorollaByteOrder [private]

Represents the native byte ordering used in the JPEG segment. If true, then we're using Motorolla ordering (Big endian), else we're using Intel ordering (Little endian).

Metadata _metadata [private]

Bean instance to store information about the image and camera/scanner/capture device.

final int [] BYTES_PER_FORMAT = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8} [static, package]

The number of bytes used per format descriptor.

final int FMT_BYTE = 1 [static, private]

final int FMT_DOUBLE = 12 [static, private]

final int FMT_SBYTE = 6 [static, private]

final int FMT_SINGLE = 11 [static, private]

final int FMT_SLONG = 9 [static, private]

final int FMT_SRATIONAL = 10 [static, private]

final int FMT_SSHORT = 8 [static, private]

final int FMT_STRING = 2 [static, private]

final int FMT_ULONG = 4 [static, private]

final int FMT_UNDEFINED = 7 [static, private]

final int FMT_URATIONAL = 5 [static, private]

final int FMT_USHORT = 3 [static, private]

final int MAX_FORMAT_CODE = 12 [static, private]

The number of formats known.

final int TAG_EXIF_OFFSET = 0x8769 [static]

final int TAG_GPS_INFO_OFFSET = 0x8825 [static]

final int TAG_INTEROP_OFFSET = 0xA005 [static]

final int TAG_MAKER_NOTE = 0x927C [static]

int TIFF_HEADER_START_OFFSET = 6 [static]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:42:30 2012 for Project Wonder by  doxygen 1.5.8