|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TypeDefinitionString
Specifies the definition of a property type that consists, effectively, of an array of the underlying character or integer type. In the MAJ API, all strings are represented as Java strings.
String type definitions have an underlying element type that can be
found be calling getElementType()
. The element type can be either
a character type or an integer type. The methods of this class allow the manipulation of string property
values in a way that hides the underlying value type.
For any conversion between arrays of integer
values and Java strings or vice versa, the character set returned by
getCharacterSet()
is used. This character set can also be set using
to a user-defined value with setCharacterSet(String)
and the defined
byte order of any buffer is respected. The default value
for this property is "UTF-16
", which is the same as the default
character set for the Java platform.
Due to the object-oriented representation of arrays in Java including a defined length, sequences of data are not expected to be terminated with null bytes.
Property values containing null
as the value for a string are
acceptable.
makeTypeDefinitionString()
,
TypeCategory.String
,
String
,
TypeDefinitionCharacter
Method Summary | |
---|---|
void |
appendElements(PropertyValue stringProperty,
Buffer elements)
Append to the string value of the given property value using a data buffer. |
void |
appendElements(PropertyValue stringProperty,
PropertyValue[] elements)
Append to the string value of the given property value using the array of property value elements. |
void |
appendString(PropertyValue stringProperty,
Buffer extension)
Appends the given data buffer to the string of the given property value. |
void |
appendString(PropertyValue stringProperty,
String extension)
Appends the given Java String to the string of the given property value. |
PropertyValue |
createValueFromString(Buffer initialData)
Create a new string type property value consistent with this type definition from the given data buffer. |
PropertyValue |
createValueFromString(String initialData)
Create a new string type property value consistent with this type definition from the given Java string. |
String |
getCharacterSet()
Returns the character set that will be used for conversion between a Java string and this string type definition. |
int |
getCount(PropertyValue stringProperty)
Returns the length of the string contained in the given string property value, measured in the number of characters. |
Buffer |
getElements(PropertyValue stringProperty)
Returns the value of the given string property as a data buffer consistent with the element type of this string type definition. |
TypeDefinition |
getElementType()
Returns the underlying AAF type used to represent characters of a string of this string type definition. |
PropertyValue[] |
getPropertyValues(PropertyValue stringProperty)
Returns the value of the given string property as an array of property values of a compatible type to the string type definition, as returned by getElementType() . |
String |
getString(PropertyValue stringProperty)
Returns the value of the given string property as a Java string. |
void |
setCharacterSet(String charSet)
Set the character set that will be used for conversion between a Java string and this string type definition. |
void |
setString(PropertyValue stringProperty,
Buffer data)
Set the value of the string contained in the given string property value to the given data buffer. |
void |
setString(PropertyValue stringProperty,
String data)
Set the value of the string contained in the given string property value to the given Java string value. |
Methods inherited from interface tv.amwa.maj.iface.TypeDefinition |
---|
createValue, getTypeCategory |
Methods inherited from interface tv.amwa.maj.iface.MetaDefinition |
---|
getAUID, getDescription, getName, setDescription, setName |
Method Detail |
---|
TypeDefinition getElementType()
Returns the underlying AAF type used to represent characters of a string of this string type definition.
@UInt32 int getCount(PropertyValue stringProperty) throws NullPointerException, IllegalPropertyValueException
Returns the length of the string contained in the given string property value, measured in the number of characters.
stringProperty
- Property value containing a string to determine
the length of.
NullPointerException
- The given string property value is null
.
IllegalPropertyValueException
- The given string property value type does not match
this string type definition.String.length()
PropertyValue createValueFromString(String initialData)
Create a new string type property value consistent with
this type definition from the given Java string. Conversion to
the underlying character type takes place according to the
character set returned by getCharacterSet()
. Setting
a null
value will result in the return of a property
value with its internal string representation set to
null
.
initialData
- Initial string data to create a new string
property value.
createValueFromString(Buffer)
PropertyValue createValueFromString(Buffer initialData) throws IllegalArgumentException
Create a new string type property value consistent with
this type definition from the given data buffer. Any character
set conversion required takes place using the
character set returned by getCharacterSet()
. Setting
a null
value will result in the return of a property
value with its internal string representation set to
null
.
The buffer of data must be one of the following types:
Any other buffer types will result in an IllegalArgumentException
.
initialData
- Initial string data to use to create a new string
property value.
IllegalArgumentException
- The given buffer must be of an appropriate type for
conversion to the underlying element type for this string type definition.createValueFromString(Buffer)
void setString(PropertyValue stringProperty, String data) throws NullPointerException, IllegalPropertyValueException
Set the value of the string contained in the given
string property value to the given Java
string value. Any character set conversion required takes place using the
character set returned by getCharacterSet()
. Setting
a null
value will result in the return of a property
value with its internal string representation set to
null
.
stringProperty
- Property value to have its string value set.data
- Value to set for the string type property value, represented
as a Java String.
NullPointerException
- The given string property value is null
.
IllegalPropertyValueException
- The given string property type does not match
this string type definition.getString(PropertyValue)
,
setString(PropertyValue, Buffer)
void setString(PropertyValue stringProperty, Buffer data) throws NullPointerException, IllegalPropertyValueException, IllegalArgumentException
Set the value of the string contained in the given
string property value to the given data buffer.
Any character set conversion required takes place using the
character set returned by getCharacterSet()
. Setting
a null
value will result in the return of a property
value with its internal string representation set to
null
.
The buffer of data must be one of the following types:
Any other buffer types will result in an IllegalArgumentException
.
stringProperty
- Property value to have its string value set.data
- Value to set for the string type property value, represented
as a data buffer.
NullPointerException
- The given string property is null
.
IllegalPropertyValueException
- The given string property type does not match
this string type definition.
IllegalArgumentException
- The given buffer must be of an appropriate type for
conversion to the underlying element type for this string type definition.getElements(PropertyValue)
,
setString(PropertyValue, String)
void appendElements(PropertyValue stringProperty, PropertyValue[] elements) throws NullPointerException, BadTypeException, IllegalPropertyValueException, BadSizeException
Append to the string value of the given property value using
the array of property value elements. Each
element of the given array must match the type definition returned
by getElementType()
.
stringProperty
- Property value containing a string to be
extended.elements
- Array of property value elements to use to extend
the given string.
NullPointerException
- One or both of the arguments is/are null
, or
one or more of the values of the given array is null
.
BadTypeException
- One or more of the elements of the given array
of property values is of an incompatible type.
IllegalPropertyValueException
- The given string property value is not
of this string type definition.
BadSizeException
- The number of bytes per integer of the underlying element
type of this string type definition is not supported by this implementation.appendElements(PropertyValue, Buffer)
,
appendString(PropertyValue, String)
void appendElements(PropertyValue stringProperty, Buffer elements) throws NullPointerException, IllegalArgumentException, IllegalPropertyValueException
Append to the string value of the given property value using
a data buffer. Any character set conversion required takes place using the
character set returned by getCharacterSet()
. An attempt to
pass in a null
buffer will result in no change to the property
value and no error.
The buffer of data must be one of the following types:
Any other buffer types will result in an IllegalArgumentException
.
This method has the same behaviour as appendString(PropertyValue, Buffer)
.
stringProperty
- Property value containing a string value
to append the given elements to.elements
- Buffer containing values to be appended to to
the given property value.
NullPointerException
- The given string property argument is null
.
IllegalArgumentException
- The given buffer must be of an appropriate type
for conversion to the underlying element type for this string type definition.
IllegalPropertyValueException
- The given string property type does not match this
type definition.appendElements(PropertyValue, PropertyValue[])
,
appendString(PropertyValue, String)
void appendString(PropertyValue stringProperty, String extension) throws NullPointerException, IllegalPropertyValueException
Appends the given Java String to the string of the given
property value. Any character set conversion required takes place using the
character set returned by getCharacterSet()
. An attempt to
pass a null
string will result in no change to the property
value and no error.
stringProperty
- Property value containing the string to extend.extension
- String to append to the end of the given property
value.
NullPointerException
- The given string property argument is null
.
IllegalPropertyValueException
- The given string property value type does not match
this string type definition.appendString(PropertyValue, Buffer)
,
appendElements(PropertyValue, PropertyValue[])
void appendString(PropertyValue stringProperty, Buffer extension) throws NullPointerException, IllegalArgumentException, IllegalPropertyValueException
Appends the given data buffer to the string of the given
property value. Any character set conversion required takes place using the
character set returned by getCharacterSet()
. An attempt to
pass a null
buffer will result in no change to the property
value and no error.
The buffer of data must be one of the following types:
Any other buffer types will result in an IllegalArgumentException
.
This method has the same behaviour as appendElements(PropertyValue, Buffer)
.
stringProperty
- Property value containing the string to extend.extension
- Buffer of string data to use to extend the given property value.
NullPointerException
- The given string property value is null
.
IllegalArgumentException
- The given buffer must be of an appropriate type for
conversion to the underlying element type for this string type definition.
IllegalPropertyValueException
- The given string property value type does not match
this string type definition.appendElements(PropertyValue, PropertyValue[])
,
appendString(PropertyValue, String)
Buffer getElements(PropertyValue stringProperty) throws NullPointerException, IllegalPropertyValueException, BadSizeException
Returns the value of the given string property as a data buffer
consistent with the element type of this string type definition.
Any character set conversion required takes place using the
character set returned by getCharacterSet()
. If the internal
representation of the string property value is null
then
this method will return null
.
Note that a null
character will not be inserted as the last
byte of the buffer.
stringProperty
- Property value containing the string to convert.
NullPointerException
- The given string property value is null
.
IllegalPropertyValueException
- The given string property type does not match
this string property value.
BadSizeException
- The number of bytes per integer of the underlying element type of this
string type definition is not supported by this implementation.setString(PropertyValue, Buffer)
,
getString(PropertyValue)
PropertyValue[] getPropertyValues(PropertyValue stringProperty) throws NullPointerException, IllegalPropertyValueException, BadSizeException
Returns the value of the given string property as an array of
property values of a compatible type to the
string type definition, as returned by getElementType()
.
stringProperty
- Property value containing the string to convert.
NullPointerException
- The given string property value is null
.
IllegalPropertyValueException
- The type of the given string property value does not match this
string type definition.
BadSizeException
- The number of bytes per integer of the underlying element type of this
string type definition is not supported by this implementation.appendElements(PropertyValue, PropertyValue[])
String getString(PropertyValue stringProperty) throws NullPointerException, IllegalPropertyValueException
Returns the value of the given string property as a Java string.
stringProperty
- Property value containing the string to convert.
null
string.
NullPointerException
- The given string property value is null
.
IllegalPropertyValueException
- The given string property is not of
this string type definition.String getCharacterSet()
Returns the character set that will be used for conversion between a Java
string and this string type definition. If a character
set has not been provided by a user then the value returned will be the default
Java character set of "UTF-16
".
Charset
void setCharacterSet(String charSet) throws NullPointerException, UnsupportedCharsetException
Set the character set that will be used for conversion between a Java string and this string type definition. For information on valid character set names, see the relevant Java API documentation.
charSet
- Character set used for conversion between this string type and Java strings.
NullPointerException
- The given character set name is null
.
UnsupportedCharsetException
- The named character set is not supported in the
underlying implementation of Java.Charset
|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |