All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class quicktime.util.QTUtils

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

public final class QTUtils
extends Object
implements QuickTimeLib
This provides a set of routines to convert between types that the QT calls expect and the basic Java classes and types

Some of the structures in QT are kept in their native BigEndian format.

These conversions are generally done for you where they are required in the get/set methods of the classes concerned.


Method Index

 o checkFreeMemory()
This call will ensure that a reserved amount of application heap memory on the MacOS is free.
 o convertEventModifier(int)
Convert the modifier values in java InputEvents to those expected by QT.
 o convertKeyValue(int)
Convert the key values in java KeyEvents to those expected by QT.
 o CString2String(byte[], int)
Converts a CString into a java.lang.String.
 o endianFlip(Object, int, EndianDescriptor)
This will flip the supplied src object's fields according to the characteristics of the supplied EndianDescriptor.
 o endianFlip(Object, int, Object, int, EndianDescriptor)
This will flip the supplied src object's fields according to the characteristics of the supplied EndianDescriptor and copy these flipped values to the destination object.
 o endianFlip16(short)
This will flip the endian order of a 16bit value
 o endianFlip32(int)
This will flip the endian order of a 32bit value
 o endianFlip64(long)
This will flip the endian order of a 64bit value
 o Fix2X(int)
Convert a float to a 16.16 Fixed format
 o Fract2X(int)
Convert a 2.30 Fract format to a float
 o fromOSType(int)
Converts an int into a 4 character string representing an OSType.
 o PString2String(byte[], int)
Converts a PString into a java.lang.String.
 o reclaimMemory()
Reclaim as much memory as possible and ensure that all finalize methods are called on objects which have been collected.
 o ShortFix2X(short)
Convert a 8.8 Fixed format to a float
 o String2CString(String)
Convert a java.lang.String to a CString byte array.
 o String2PString(String, int)
Convert a java.lang.String to a PString byte array.
 o toOSType(char, char, char, char)
Converts four characters into an OSType int
 o toOSType(String)
Converts an OSType (4 character) string into an int.
 o UByte2Int(byte)
converts an unsigned byte to int.
 o UFix2X(int)
Convert a 16.16 Unsigned Fixed format to a float
 o UInt2Long(int)
converts an unsigned int to long.
 o UShort2Int(short)
converts an unsigned short to int.
 o X2Fix(float)
Convert a float to a 16.16 Fixed format
 o X2Fract(float)
Converts a float to a 2.30 Fract format
 o X2ShortFix(float)
Convert a float to a 8.8 Fixed format
 o X2UFix(float)
Convert a 16.16 Unsigned Fixed format to a float

Methods

 o convertEventModifier
 public static int convertEventModifier(int javaEvtMod)
Convert the modifier values in java InputEvents to those expected by QT.

 o convertKeyValue
 public static int convertKeyValue(int javaKeyValue)
Convert the key values in java KeyEvents to those expected by QT.

 o X2Fix
 public static int X2Fix(float x)
Convert a float to a 16.16 Fixed format

 o Fix2X
 public static float Fix2X(int fix)
Convert a float to a 16.16 Fixed format

 o X2UFix
 public static int X2UFix(float x)
Convert a 16.16 Unsigned Fixed format to a float

 o UFix2X
 public static float UFix2X(int fix)
Convert a 16.16 Unsigned Fixed format to a float

 o X2Fract
 public static int X2Fract(float x)
Converts a float to a 2.30 Fract format

 o Fract2X
 public static float Fract2X(int fract)
Convert a 2.30 Fract format to a float

 o X2ShortFix
 public static short X2ShortFix(float x)
Convert a float to a 8.8 Fixed format

 o ShortFix2X
 public static float ShortFix2X(short fix)
Convert a 8.8 Fixed format to a float

 o UByte2Int
 public static int UByte2Int(byte b)
converts an unsigned byte to int.

 o UShort2Int
 public static int UShort2Int(short s)
converts an unsigned short to int.

 o UInt2Long
 public static long UInt2Long(int i)
converts an unsigned int to long.

 o String2CString
 public static byte[] String2CString(String str)
Convert a java.lang.String to a CString byte array.

Parameters:
str - the String to convert
 o String2PString
 public static byte[] String2PString(String str,
                                     int len)
Convert a java.lang.String to a PString byte array.

Parameters:
str - the String to convert
len - the maximum length of the Pstring, max length is 255.
 o CString2String
 public static String CString2String(byte str[],
                                     int offset)
Converts a CString into a java.lang.String. The offset specifies where the C string begins and it terminates at the first 0 value that it finds.

 o PString2String
 public static String PString2String(byte pString[],
                                     int offset)
Converts a PString into a java.lang.String. The offset specifies where the count byte is within the byte array that is passed in - typically 0.

 o toOSType
 public static final int toOSType(String str)
Converts an OSType (4 character) string into an int.

 o toOSType
 public static final int toOSType(char a,
                                  char b,
                                  char c,
                                  char d)
Converts four characters into an OSType int

 o fromOSType
 public static String fromOSType(int osType)
Converts an int into a 4 character string representing an OSType. The OSType int is presumed to be the right endian layout.

 o reclaimMemory
 public static void reclaimMemory()
Reclaim as much memory as possible and ensure that all finalize methods are called on objects which have been collected.

 o checkFreeMemory
 public static void checkFreeMemory() throws UtilException
This call will ensure that a reserved amount of application heap memory on the MacOS is free. If this amount of memory is not free a memFullErr will be thrown.

 o endianFlip16
 public static short endianFlip16(short s)
This will flip the endian order of a 16bit value

Parameters:
s - the value to flip
Returns:
the flipped value
See Also:
EndianOrder
 o endianFlip32
 public static int endianFlip32(int i)
This will flip the endian order of a 32bit value

Parameters:
i - the value to flip
Returns:
the flipped value
See Also:
EndianOrder
 o endianFlip64
 public static long endianFlip64(long l)
This will flip the endian order of a 64bit value

Parameters:
l - the value to flip
Returns:
the flipped value
See Also:
EndianOrder
 o endianFlip
 public static void endianFlip(Object src,
                               int srcOffset,
                               EndianDescriptor ed) throws UtilException
This will flip 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
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
 o endianFlip
 public static void endianFlip(Object src,
                               int srcOffset,
                               Object dest,
                               int destOffset,
                               EndianDescriptor ed) throws UtilException
This will flip the supplied src object's fields according to the characteristics of the supplied EndianDescriptor and copy these flipped values to the destination object. 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
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.
See Also:
EndianOrder

All Packages  Class Hierarchy  This Package  Previous  Next  Index