quicktime.util
Class EndianOrder

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

public final class EndianOrder
extends java.lang.Object

The endian methods in this class are context sensitive, in that the big-endian methods will only flip if the current platform is little endian and the little-endian methods will only flip if the current platform is big endian.

The names of the methods are provided as a means of documenting the usage of the method itself. To operate as specified they rely upon the application correctly providing the expected endian-ordered number to the method. Thus, the flipNativeToBigEndian and flipBigEndianToNative will both flip when executed on a little-endian architecture but the methods are unable to determine if the argument is actually (in this case) in native little-endian order or big endian order. The application itself must ensure that the provided argument is correct for these methods to return their exepcted result.


Method Summary
static void flipBigEndianToNative(java.lang.Object src, int srcOffset, EndianDescriptor ed)
          This will flip, iff the current runtime architecture is little endian, the supplied src object's fields according to the characteristics of the supplied EndianDescriptor.
static void flipBigEndianToNative(java.lang.Object src, int srcOffset, java.lang.Object dest, int destOffset, EndianDescriptor ed)
          This will flip, iff the current runtime architecture is little endian, the supplied src object's fields according to the characteristics of the supplied EndianDescriptor and copy these flipped values to the destination object.
static short flipBigEndianToNative16(short s)
          This will flip the endian order of a 16bit value iff the current runtime architecture is little endian, otherwise the returned value is the same as the supplied value.
static int flipBigEndianToNative32(int i)
          This will flip the endian order of a 32bit value iff the current runtime architecture is little endian, otherwise the returned value is the same as the supplied value.
static long flipBigEndianToNative64(long l)
          This will flip the endian order of a 64bit value iff the current runtime architecture is little endian, otherwise the returned value is the same as the supplied value.
static void flipLittleEndianToNative(java.lang.Object src, int srcOffset, EndianDescriptor ed)
          This will flip, iff the current runtime architecture is big endian, the supplied src object's fields according to the characteristics of the supplied EndianDescriptor.
static void flipLittleEndianToNative(java.lang.Object src, int srcOffset, java.lang.Object dest, int destOffset, EndianDescriptor ed)
          This will flip, iff the current runtime architecture is big endian, the supplied src object's fields according to the characteristics of the supplied EndianDescriptor and copy these flipped values to the destination object.
static short flipLittleEndianToNative16(short s)
          This will flip the endian order of a 16bit value iff the current runtime architecture is big endian, otherwise the returned value is the same as the supplied value.
static int flipLittleEndianToNative32(int i)
          This will flip the endian order of a 32bit value iff the current runtime architecture is big endian, otherwise the returned value is the same as the supplied value.
static long flipLittleEndianToNative64(long l)
          This will flip the endian order of a 64bit value iff the current runtime architecture is big endian, otherwise the returned value is the same as the supplied value.
static void flipNativeToBigEndian(java.lang.Object src, int srcOffset, EndianDescriptor ed)
          This will flip iff the current runtime architecture is little endian the supplied src object's fields according to the characteristics of the supplied EndianDescriptor.
static void flipNativeToBigEndian(java.lang.Object src, int srcOffset, java.lang.Object dest, int destOffset, EndianDescriptor ed)
          This will flip, iff the current runtime architecture is little endian, the supplied src object's fields according to the characteristics of the supplied EndianDescriptor and copy these flipped values to the destination object.
static short flipNativeToBigEndian16(short s)
          This will flip the endian order of a 16bit value iff the current runtime architecture is little endian, otherwise the returned value is the same as the supplied value.
static int flipNativeToBigEndian32(int i)
          This will flip the endian order of a 32bit value iff the current runtime architecture is little endian, otherwise the returned value is the same as the supplied value.
static long flipNativeToBigEndian64(long l)
          This will flip the endian order of a 64bit value iff the current runtime architecture is little endian, otherwise the returned value is the same as the supplied value.
static void flipNativeToLittleEndian(java.lang.Object src, int srcOffset, EndianDescriptor ed)
          This will flip, iff the current runtime architecture is big endian, the supplied src object's fields according to the characteristics of the supplied EndianDescriptor.
static void flipNativeToLittleEndian(java.lang.Object src, int srcOffset, java.lang.Object dest, int destOffset, EndianDescriptor ed)
          This will flip, iff the current runtime architecture is big endian, the supplied src object's fields according to the characteristics of the supplied EndianDescriptor and copy these flipped values to the destination object.
static short flipNativeToLittleEndian16(short s)
          This will flip the endian order of a 16bit value iff the current runtime architecture is big endian, otherwise the returned value is the same as the supplied value.
static int flipNativeToLittleEndian32(int i)
          This will flip the endian order of a 32bit value iff the current runtime architecture is big endian, otherwise the returned value is the same as the supplied value.
static long flipNativeToLittleEndian64(long l)
          This will flip the endian order of a 64bit value iff the current runtime architecture is big endian, otherwise the returned value is the same as the supplied value.
static boolean isNativeBigEndian()
          Returns true if the current runtime architecture is big endian.
static boolean isNativeLittleEndian()
          Returns true if the current runtime architecture is little endian.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isNativeLittleEndian

public static boolean isNativeLittleEndian()
Returns true if the current runtime architecture is little endian.
Returns:
a boolean

isNativeBigEndian

public static boolean isNativeBigEndian()
Returns true if the current runtime architecture is big endian.
Returns:
a boolean

flipNativeToBigEndian16

public static short flipNativeToBigEndian16(short s)
This will flip the endian order of a 16bit value iff the current runtime architecture is little endian, otherwise the returned value is the same as the supplied value.
Parameters:
s - the value to flip
Returns:
the flipped value if the runtime architecture is little endian, otherwise the original value

flipBigEndianToNative16

public static short flipBigEndianToNative16(short s)
This will flip the endian order of a 16bit value iff the current runtime architecture is little endian, otherwise the returned value is the same as the supplied value.
Parameters:
s - the value to flip
Returns:
the flipped value if the runtime architecture is little endian, otherwise the original value

flipNativeToLittleEndian16

public static short flipNativeToLittleEndian16(short s)
This will flip the endian order of a 16bit value iff the current runtime architecture is big endian, otherwise the returned value is the same as the supplied value.
Parameters:
s - the value to flip
Returns:
the flipped value if the runtime architecture is big endian, otherwise the original value

flipLittleEndianToNative16

public static short flipLittleEndianToNative16(short s)
This will flip the endian order of a 16bit value iff the current runtime architecture is big endian, otherwise the returned value is the same as the supplied value.
Parameters:
s - the value to flip
Returns:
the flipped value if the runtime architecture is big endian, otherwise the original value

flipNativeToBigEndian32

public static int flipNativeToBigEndian32(int i)
This will flip the endian order of a 32bit value iff the current runtime architecture is little endian, otherwise the returned value is the same as the supplied value.
Parameters:
i - the value to flip
Returns:
the flipped value if the runtime architecture is little endian, otherwise the original value

flipBigEndianToNative32

public static int flipBigEndianToNative32(int i)
This will flip the endian order of a 32bit value iff the current runtime architecture is little endian, otherwise the returned value is the same as the supplied value.
Parameters:
i - the value to flip
Returns:
the flipped value if the runtime architecture is little endian, otherwise the original value

flipNativeToLittleEndian32

public static int flipNativeToLittleEndian32(int i)
This will flip the endian order of a 32bit value iff the current runtime architecture is big endian, otherwise the returned value is the same as the supplied value.
Parameters:
i - the value to flip
Returns:
the flipped value if the runtime architecture is big endian, otherwise the original value

flipLittleEndianToNative32

public static int flipLittleEndianToNative32(int i)
This will flip the endian order of a 32bit value iff the current runtime architecture is big endian, otherwise the returned value is the same as the supplied value.
Parameters:
i - the value to flip
Returns:
the flipped value if the runtime architecture is big endian, otherwise the original value

flipNativeToBigEndian64

public static long flipNativeToBigEndian64(long l)
This will flip the endian order of a 64bit value iff the current runtime architecture is little endian, otherwise the returned value is the same as the supplied value.
Parameters:
l - the value to flip
Returns:
the flipped value if the runtime architecture is little endian, otherwise the original value

flipBigEndianToNative64

public static long flipBigEndianToNative64(long l)
This will flip the endian order of a 64bit value iff the current runtime architecture is little endian, otherwise the returned value is the same as the supplied value.
Parameters:
l - the value to flip
Returns:
the flipped value if the runtime architecture is little endian, otherwise the original value

flipNativeToLittleEndian64

public static long flipNativeToLittleEndian64(long l)
This will flip the endian order of a 64bit value iff the current runtime architecture is big endian, otherwise the returned value is the same as the supplied value.
Parameters:
l - the value to flip
Returns:
the flipped value if the runtime architecture is big endian, otherwise the original value

flipLittleEndianToNative64

public static long flipLittleEndianToNative64(long l)
This will flip the endian order of a 64bit value iff the current runtime architecture is big endian, otherwise the returned value is the same as the supplied value.
Parameters:
l - the value to flip
Returns:
the flipped value if the runtime architecture is big endian, otherwise the original value

flipNativeToBigEndian

public static void flipNativeToBigEndian(java.lang.Object src,
                                         int srcOffset,
                                         EndianDescriptor ed)
                                  throws UtilException
This will flip iff the current runtime architecture is little endian the supplied src object's fields according to the characteristics of the supplied EndianDescriptor. The EndianDescriptor will be applied to the src object at the specified (srcOffset) number of bytes from the beginning of the src object. The flipping is done in place, so the srcObject will be flipped upon the completion of this method. Any fields that are not described or accounted for by the EndianDescriptor will not be flipped.
Parameters:
src - the object to flip iff the current runtime architecture is little endian
srcOffset - the number of bytes from the start of the src object that the supplied endian descriptor will be applied.
ed - the EndianDescriptor that will describe how the object should be flipped. This may NOT be null.
See Also:
EndianOrder

flipBigEndianToNative

public static void flipBigEndianToNative(java.lang.Object src,
                                         int srcOffset,
                                         EndianDescriptor ed)
                                  throws UtilException
This will flip, iff the current runtime architecture is little endian, the supplied src object's fields according to the characteristics of the supplied EndianDescriptor. It the current runtime architecture is big endian the src object is left unchanged. The EndianDescriptor will be applied to the src object at the specified (srcOffset) number of bytes from the beginning of the src object. The flipping is done in place, so the srcObject will be flipped upon the completion of this method. Any fields that are not described or accounted for by the EndianDescriptor will not be flipped.
Parameters:
src - the object to flip iff the current runtime architecture is little endian
srcOffset - the number of bytes from the start of the src object that the supplied endian descriptor will be applied.
ed - the EndianDescriptor that will describe how the object should be flipped. This may NOT be null.
See Also:
EndianOrder

flipNativeToLittleEndian

public static void flipNativeToLittleEndian(java.lang.Object src,
                                            int srcOffset,
                                            EndianDescriptor ed)
                                     throws UtilException
This will flip, iff the current runtime architecture is big endian, the supplied src object's fields according to the characteristics of the supplied EndianDescriptor. It the current runtime architecture is little endian the src object is left unchanged. The EndianDescriptor will be applied to the src object at the specified (srcOffset) number of bytes from the beginning of the src object. The flipping is done in place, so the srcObject will be flipped upon the completion of this method. Any fields that are not described or accounted for by the EndianDescriptor will not be flipped.
Parameters:
src - the object to flip iff the current runtime architecture is big endian
srcOffset - the number of bytes from the start of the src object that the supplied endian descriptor will be applied.
ed - the EndianDescriptor that will describe how the object should be flipped. This may NOT be null.

flipLittleEndianToNative

public static void flipLittleEndianToNative(java.lang.Object src,
                                            int srcOffset,
                                            EndianDescriptor ed)
                                     throws UtilException
This will flip, iff the current runtime architecture is big endian, the supplied src object's fields according to the characteristics of the supplied EndianDescriptor. It the current runtime architecture is little endian the src object is left unchanged. The EndianDescriptor will be applied to the src object at the specified (srcOffset) number of bytes from the beginning of the src object. The flipping is done in place, so the srcObject will be flipped upon the completion of this method. Any fields that are not described or accounted for by the EndianDescriptor will not be flipped.
Parameters:
src - the object to flip iff the current runtime architecture is big endian
srcOffset - the number of bytes from the start of the src object that the supplied endian descriptor will be applied.
ed - the EndianDescriptor that will describe how the object should be flipped. This may NOT be null.

flipNativeToBigEndian

public static void flipNativeToBigEndian(java.lang.Object src,
                                         int srcOffset,
                                         java.lang.Object dest,
                                         int destOffset,
                                         EndianDescriptor ed)
                                  throws UtilException
This will flip, iff the current runtime architecture is little endian, the supplied src object's fields according to the characteristics of the supplied EndianDescriptor and copy these flipped values to the destination object. It the current runtime architecture is big endian the src object is left unchanged. The EndianDescriptor will be applied to the src object at the specified (srcOffset) number of bytes from the beginning of the src object and the flipped values will be copied to the specified (destOffset) number of bytes into the destination object. Any fields that are not described or accounted for by the EndianDescriptor will not be flipped or copied.
Parameters:
src - the object to flip iff the current runtime architecture is little endian
srcOffset - the number of bytes from the start of the src object that the supplied endian descriptor will be applied.
dest - the object that will be the flipped version of the source object.
destOffset - the number of bytes from the start of the dest object that the flipped values will be copied too.
ed - the EndianDescriptor that will describe how the object should be flipped. This may NOT be null.

flipBigEndianToNative

public static void flipBigEndianToNative(java.lang.Object src,
                                         int srcOffset,
                                         java.lang.Object dest,
                                         int destOffset,
                                         EndianDescriptor ed)
                                  throws UtilException
This will flip, iff the current runtime architecture is little endian, the supplied src object's fields according to the characteristics of the supplied EndianDescriptor and copy these flipped values to the destination object. It the current runtime architecture is big endian the src object is left unchanged. The EndianDescriptor will be applied to the src object at the specified (srcOffset) number of bytes from the beginning of the src object and the flipped values will be copied to the specified (destOffset) number of bytes into the destination object. Any fields that are not described or accounted for by the EndianDescriptor will not be flipped or copied.
Parameters:
src - the object to flip iff the current runtime architecture is little endian
srcOffset - the number of bytes from the start of the src object that the supplied endian descriptor will be applied.
dest - the object that will be the flipped version of the source object.
destOffset - the number of bytes from the start of the dest object that the flipped values will be copied too.
ed - the EndianDescriptor that will describe how the object should be flipped. This may NOT be null.

flipNativeToLittleEndian

public static void flipNativeToLittleEndian(java.lang.Object src,
                                            int srcOffset,
                                            java.lang.Object dest,
                                            int destOffset,
                                            EndianDescriptor ed)
                                     throws UtilException
This will flip, iff the current runtime architecture is big endian, the supplied src object's fields according to the characteristics of the supplied EndianDescriptor and copy these flipped values to the destination object. It the current runtime architecture is little endian the src object is left unchanged. The EndianDescriptor will be applied to the src object at the specified (srcOffset) number of bytes from the beginning of the src object and the flipped values will be copied to the specified (destOffset) number of bytes into the destination object. Any fields that are not described or accounted for by the EndianDescriptor will not be flipped or copied.
Parameters:
src - the object to flip iff the current runtime architecture is big endian
srcOffset - the number of bytes from the start of the src object that the supplied endian descriptor will be applied.
dest - the object that will be the flipped version of the source object.
destOffset - the number of bytes from the start of the dest object that the flipped values will be copied too.
ed - the EndianDescriptor that will describe how the object should be flipped. This may NOT be null.

flipLittleEndianToNative

public static void flipLittleEndianToNative(java.lang.Object src,
                                            int srcOffset,
                                            java.lang.Object dest,
                                            int destOffset,
                                            EndianDescriptor ed)
                                     throws UtilException
This will flip, iff the current runtime architecture is big endian, the supplied src object's fields according to the characteristics of the supplied EndianDescriptor and copy these flipped values to the destination object. It the current runtime architecture is little endian the src object is left unchanged. The EndianDescriptor will be applied to the src object at the specified (srcOffset) number of bytes from the beginning of the src object and the flipped values will be copied to the specified (destOffset) number of bytes into the destination object. Any fields that are not described or accounted for by the EndianDescriptor will not be flipped or copied.
Parameters:
src - the object to flip iff the current runtime architecture is big endian
srcOffset - the number of bytes from the start of the src object that the supplied endian descriptor will be applied.
dest - the object that will be the flipped version of the source object.
destOffset - the number of bytes from the start of the dest object that the flipped values will be copied too.
ed - the EndianDescriptor that will describe how the object should be flipped. This may NOT be null.