org.w3c.tools.jpeg
Class ExifData

java.lang.Object
  extended by 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
See Also:
Constant Field Values

FMT_BYTE

public static final int FMT_BYTE
See Also:
Constant Field Values

FMT_STRING

public static final int FMT_STRING
See Also:
Constant Field Values

FMT_USHORT

public static final int FMT_USHORT
See Also:
Constant Field Values

FMT_ULONG

public static final int FMT_ULONG
See Also:
Constant Field Values

FMT_URATIONAL

public static final int FMT_URATIONAL
See Also:
Constant Field Values

FMT_SBYTE

public static final int FMT_SBYTE
See Also:
Constant Field Values

FMT_UNDEFINED

public static final int FMT_UNDEFINED
See Also:
Constant Field Values

FMT_SSHORT

public static final int FMT_SSHORT
See Also:
Constant Field Values

FMT_SLONG

public static final int FMT_SLONG
See Also:
Constant Field Values

FMT_SRATIONAL

public static final int FMT_SRATIONAL
See Also:
Constant Field Values

FMT_SINGLE

public static final int FMT_SINGLE
See Also:
Constant Field Values

FMT_DOUBLE

public static final int FMT_DOUBLE
See Also:
Constant Field Values
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)