quicktime.util
Class EndianDescriptor

java.lang.Object
  |
  +--quicktime.util.EndianDescriptor

public class EndianDescriptor
extends java.lang.Object

An EndianDescriptor is used to describe the flipping requirements of a particular data-structure. It has three modes which are determined by the format flag which is provided in the constructor:

An application can build EndianDescriptor objects for any custom data structures that require endian flipping for consistency between platforms with different endian orders and data files (like the QuickTime Movie File) that generally require data to have a particular endian format.

The EndianDescriptor objects is used with the QTUtils.endianFlip calls or the platform sensitive EndianOrder.flip... methods.


Field Summary
static EndianDescriptor flipAll16
          This object is used to describe data that should be flipped around 16bit size.
static EndianDescriptor flipAll32
          This object is used to describe data that should be flipped around 32bit size.
static EndianDescriptor flipAll64
          This object is used to describe data that should be flipped around 64bit size.
static int kFlipAllFields16
          Describes the modal state of the EndianDescriptor object.
static int kFlipAllFields32
          Describes the modal state of the EndianDescriptor object.
static int kFlipAllFields64
          Describes the modal state of the EndianDescriptor object.
static int kFlipNoFields
          Describes the modal state of the EndianDescriptor object.
static int kFlipSpecifiedFields
          Describes the modal state of the EndianDescriptor object.
 
Constructor Summary
EndianDescriptor(int formatFlag)
          Create an EndianDescriptor class with the supplied format.
 
Method Summary
 void addFlipSpec(EndianFlipSpec spec)
          An EndianDescriptor with the format kFlipSpecifiedFields, typically describes data that is not contiguous in size of location.
 java.util.Enumeration flipSpecs()
          Returns an Enumeration to iterate over the collection of EndianFlipSpecs or null if there is no collection to iterate over
 EndianFlipSpec getFlipSpec(int offset)
          Returns an EndianFlipSpec at the specified offset, or null if no flip spec is found in the collection at that offset.
 int getFormatFlag()
          Returns the format of the EndianDescriptor object - which determines the behaviour of the descriptor when used with the endianFlip methods.
 void removeFlipSpec(EndianFlipSpec member)
          Removes a specified EndianFlipSpec (if found) from the EndianDescriptor.
 java.lang.String toString()
          Return a String representation of this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kFlipSpecifiedFields

public static final int kFlipSpecifiedFields
Describes the modal state of the EndianDescriptor object. Only when an EndianDescriptor's format is kFlipSpecifiedFields can EndianFlipSpec objects be added

kFlipAllFields16

public static final int kFlipAllFields16
Describes the modal state of the EndianDescriptor object. Only when an EndianDescriptor's format is kFlipSpecifiedFields can EndianFlipSpec objects be added

kFlipAllFields32

public static final int kFlipAllFields32
Describes the modal state of the EndianDescriptor object. Only when an EndianDescriptor's format is kFlipSpecifiedFields can EndianFlipSpec objects be added

kFlipAllFields64

public static final int kFlipAllFields64
Describes the modal state of the EndianDescriptor object. Only when an EndianDescriptor's format is kFlipSpecifiedFields can EndianFlipSpec objects be added

kFlipNoFields

public static final int kFlipNoFields
Describes the modal state of the EndianDescriptor object. Only when an EndianDescriptor's format is kFlipSpecifiedFields can EndianFlipSpec objects be added

flipAll16

public static final EndianDescriptor flipAll16
This object is used to describe data that should be flipped around 16bit size.

flipAll32

public static final EndianDescriptor flipAll32
This object is used to describe data that should be flipped around 32bit size.

flipAll64

public static final EndianDescriptor flipAll64
This object is used to describe data that should be flipped around 64bit size.
Constructor Detail

EndianDescriptor

public EndianDescriptor(int formatFlag)
Create an EndianDescriptor class with the supplied format.
Parameters:
formatFlag - specifies the mode of the EndianDescriptor object.
Method Detail

getFormatFlag

public int getFormatFlag()
Returns the format of the EndianDescriptor object - which determines the behaviour of the descriptor when used with the endianFlip methods.
Returns:
an int

addFlipSpec

public void addFlipSpec(EndianFlipSpec spec)
An EndianDescriptor with the format kFlipSpecifiedFields, typically describes data that is not contiguous in size of location. As such a more complex description of the flipping requirements of this data must be built, and the addition of EndianFlipSpecs is used to describe these requirements. In this case an EndianDescriptor becomes a collection of EndianFlipSpec objects that completely describe the flipping requirements of the target data object.

EndianFlipSpecs are ordered in an EndianDescriptor by the offset of these EndianFlipSpecs. When a candidate EndianFlipSpec is added to an EndianDescriptor object it will only be added if it's offset is unique in the descriptor's collection of flip spec members. If the offset already exists in the collection the new object is not added and an exception is thrown.

If and only if the format of the EndianDescriptor is kFlipSpecifiedFields can an EndianFlipSpec be added to the EndianDescriptor.

Parameters:
spec - the new spec to add to the EndianDescriptor's collection.

removeFlipSpec

public void removeFlipSpec(EndianFlipSpec member)
Removes a specified EndianFlipSpec (if found) from the EndianDescriptor.

getFlipSpec

public EndianFlipSpec getFlipSpec(int offset)
Returns an EndianFlipSpec at the specified offset, or null if no flip spec is found in the collection at that offset.
Parameters:
offset - the offset of the desired EndianFlipSpec
Returns:
the EndianFlipSpec with the specified offset value or null if no spec with that offset value

flipSpecs

public java.util.Enumeration flipSpecs()
Returns an Enumeration to iterate over the collection of EndianFlipSpecs or null if there is no collection to iterate over

toString

public java.lang.String toString()
Return a String representation of this object.
Overrides:
toString in class java.lang.Object
Returns:
a String