org.w3c.tools.jpeg
Class ExifData

java.lang.Object
  |
  +--org.w3c.tools.jpeg.ExifData

public class ExifData
extends java.lang.Object

An internal API for decoding EXIF data.

This class identifies a byte array as valid EXIF and provides methods for converting the internal representation of types to equivalent Java types.

This is a separate class in order to facilitate writing decoders for unknown fields.

Special note: string values are %-encoded to protect the caller from values that might not be legitimate UTF-8 strings.

Bugs:

The EXIF format includes unsigned integers which aren't directly available in Java. Unless I'm mistaken, they'd have to be turned into longs. But that would be inconvenient in other APIs. For the moment, I'm just treating them all as signed. I've never seen an EXIF unsigned value too large to represent in a Java int.

See Also:
Exif

Field Summary
static int[] bytesPerFormat
           
static int FMT_BYTE
           
static int FMT_DOUBLE
           
static int FMT_SBYTE
           
static int FMT_SINGLE
           
static int FMT_SLONG
           
static int FMT_SRATIONAL
           
static int FMT_SSHORT
           
static int FMT_STRING
           
static int FMT_ULONG
           
static int FMT_UNDEFINED
           
static int FMT_URATIONAL
           
static int FMT_USHORT
           
static int NUM_FORMATS
           
 
Constructor Summary
ExifData(byte[] exifData)
           
 
Method Summary
 double convertAnyValue(int format, int offset)
           
 int get16s(int offset)
           
 int get16u(int offset)
           
 int get32s(int offset)
           
 int get32u(int offset)
           
 byte[] getBytes(int offset, int length)
           
 java.lang.String getString(int offset, int length)
           
protected  java.lang.String getString(int offset, int length, boolean nullTerminated)
           
 java.lang.String getUndefined(int offset, int length)
           
 boolean isExifData()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bytesPerFormat

public static final int[] bytesPerFormat

NUM_FORMATS

public static final int NUM_FORMATS

FMT_BYTE

public static final int FMT_BYTE

FMT_STRING

public static final int FMT_STRING

FMT_USHORT

public static final int FMT_USHORT

FMT_ULONG

public static final int FMT_ULONG

FMT_URATIONAL

public static final int FMT_URATIONAL

FMT_SBYTE

public static final int FMT_SBYTE

FMT_UNDEFINED

public static final int FMT_UNDEFINED

FMT_SSHORT

public static final int FMT_SSHORT

FMT_SLONG

public static final int FMT_SLONG

FMT_SRATIONAL

public static final int FMT_SRATIONAL

FMT_SINGLE

public static final int FMT_SINGLE

FMT_DOUBLE

public static final int FMT_DOUBLE
Constructor Detail

ExifData

public ExifData(byte[] exifData)
Method Detail

isExifData

public boolean isExifData()

get16s

public int get16s(int offset)

get16u

public int get16u(int offset)

get32s

public int get32s(int offset)

get32u

public int get32u(int offset)

getBytes

public byte[] getBytes(int offset,
                       int length)

getString

public java.lang.String getString(int offset,
                                  int length)

getUndefined

public java.lang.String getUndefined(int offset,
                                     int length)

getString

protected java.lang.String getString(int offset,
                                     int length,
                                     boolean nullTerminated)

convertAnyValue

public double convertAnyValue(int format,
                              int offset)