@MediaClass(uuid1=218169601, uuid2=523, uuid3=0, uuid4={6,14,43,52,2,6,1,1}, definedName="TypeDefinitionString", description="The TypeDefinitionString class defines a property type that consists of a zero-terminated array of the underlying character or integer type.", symbol="TypeDefinitionString") public final class TypeDefinitionStringImpl extends SingletonTypeDefinitionImpl implements TypeDefinitionString, Serializable, Cloneable
Implements 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.
| Modifier and Type | Class and Description |
|---|---|
static class |
TypeDefinitionStringImpl.BaseStringValue
Base representation for all property values representing string values.
|
static class |
TypeDefinitionStringImpl.ByteArrayStringValue
Property value for strings with an underlying element type of
TypeDefinitionIntegerImpl. |
static class |
TypeDefinitionStringImpl.CharacterStringValue
Property value for strings with an underlying element type of
TypeDefinitionCharacterImpl. |
SingletonTypeDefinitionImpl.SingletonMethodBagTypeDefinitionImpl.PropertyValueImplAAF_METADICT_NAMESPACE, AAF_METADICT_PREFIX, AAF_XML_NAMESPACE, AAF_XML_PREFIX, ApplicationPluginObjectID, ApplicationPluginsID, MAX_NUM_RGBA_COMPS, MemberOfID, ObjectClassID, ParentClassID, PropertiesID, XMLClassIDAsAttributeName| Constructor and Description |
|---|
TypeDefinitionStringImpl(AUID identification,
String typeName,
TypeDefinition typeDefinition)
Creates and initializes the string type definition with its identity and the
underlying data representation.
|
| Modifier and Type | Method and Description |
|---|---|
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 |
appendMetadictXML(Node metadict,
String namespace,
String prefix)
Append an XML representation of this meta definition to the given XML node.
|
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.
|
TypeDefinitionString |
clone()
Create a cloned copy of this meta definition.
|
PropertyValue |
createFromBytes(ByteBuffer buffer)
Create a value of this type by reading the bytes in the given byte buffer.
|
PropertyValue |
createValue(Object javaValue)
Create a property value from the given Java object.
|
PropertyValue |
createValueFromString(Buffer initData)
Create a new string type property value consistent with
this type definition from the given data buffer.
|
PropertyValue |
createValueFromString(String initData)
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
TypeDefinitionString.getElementType(). |
String |
getString(PropertyValue stringProperty)
Returns the value of the given string property as a Java string.
|
TypeCategory |
getTypeCategory()
Returns the type category to which this type definition belongs, which
corresponds to its sub interface.
|
static TypeDefinition |
initializeStringElementType() |
long |
lengthAsBytes(PropertyValue value)
Returns the number of bytes that the given value of this type is serialized as a
sequence of bytes.
|
void |
setCharacterSet(String charSet)
Set the character set that will be used for conversion between a Java string
and this string type definition.
|
void |
setElementType(TypeDefinition type)
Set the underlying array element type of 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.
|
List<PropertyValue> |
writeAsBytes(PropertyValue value,
ByteBuffer buffer)
Write the given property value of this type to the given byte stream.
|
setPropertyValuegetNamespace, getPrefix, getPropertyValue, initalizeTypeNameMap, nameToAAFName, resolveReferences, writeAsStructuredStorageBytesaafNameToName, appendXMLChildren, deepEquals, equals, getAAFNamesInUse, getAliases, getAUID, getComment, getDescription, getIdentification, getName, getSymbol, getWeakTargetReference, hashCode, initializeMetaDefinitionIdentification, initializeMetaDefinitionName, setAAFNamesInUse, setAliases, setDescription, setIdentification, setName, setNamespace, setPrefix, setSymbol, toStringgetPropertyValue, resolveReferences, setPropertyValue, writeAsStructuredStorageBytesdeepEquals, equals, getAAFNamesInUse, getAliases, getAUID, getDescription, getName, getNamespace, getPrefix, getSymbol, hashCode, setAAFNamesInUse, setDescription, setName, setNamespace, setPrefix, setSymbol, toStringgetWeakTargetReferencepublic TypeDefinitionStringImpl(AUID identification, @AAFString String typeName, TypeDefinition typeDefinition) throws NullPointerException, IllegalArgumentException
Creates and initializes the string type definition with its identity and the underlying data representation. Acceptable underlying type definitions are:
It is anticipated that most Java versions of this interface will be
choose TypeDefinitionCharacterImpl and will use Java string handling
in their implementation. However, by using a call to setCharacterSet(String)
it is possible to define mappings between different character sets to and
from Java strings.
Creating new and unregistered type definitions is not recommended as this may cause
interoperability issues with other systems. The official registry of type definitions
is available from SMPTE at SMPTE Metadata Registries
And Related Items. The full range of data types documented in the AAF 1.1 object
specification can be accessed by name and identification using either
Warehouse.lookForType(String) or
Warehouse.lookForType(tv.amwa.maj.record.AUID)
respectively.
identification - AUID to be used to identify this type.typeName - Friendly name for the string data type.typeDefinition - Type of each element to be contained in the array.NullPointerException - The identification and/or type definition arguments is/are
null.IllegalArgumentException - The given type is not an acceptable underlying
type for a string type definition.public void appendElements(PropertyValue stringProperty, PropertyValue[] elements) throws NullPointerException, IllegalPropertyValueException, BadTypeException, BadSizeException
TypeDefinitionStringAppend 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 TypeDefinitionString.getElementType().
appendElements in interface TypeDefinitionStringstringProperty - 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.IllegalPropertyValueException - The given string property value is not
of this string type definition.BadTypeException - One or more of the elements of the given array
of property values is of an incompatible type.BadSizeException - The number of bytes per integer of the underlying element
type of this string type definition is not supported by this implementation.TypeDefinitionString.appendElements(PropertyValue, Buffer),
TypeDefinitionString.appendString(PropertyValue, String)public void appendElements(PropertyValue stringProperty, Buffer elements) throws NullPointerException, IllegalArgumentException, IllegalPropertyValueException
TypeDefinitionStringAppend 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 TypeDefinitionString.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 TypeDefinitionString.appendString(PropertyValue, Buffer).
appendElements in interface TypeDefinitionStringstringProperty - 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.TypeDefinitionString.appendElements(PropertyValue, PropertyValue[]),
TypeDefinitionString.appendString(PropertyValue, String)public int getCount(PropertyValue stringProperty) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionStringReturns the length of the string contained in the given string property value, measured in the number of characters.
getCount in interface TypeDefinitionStringstringProperty - 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()public Buffer getElements(PropertyValue stringProperty) throws NullPointerException, IllegalPropertyValueException, BadSizeException
TypeDefinitionStringReturns 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 TypeDefinitionString.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.
getElements in interface TypeDefinitionStringstringProperty - 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.TypeDefinitionString.setString(PropertyValue, Buffer),
TypeDefinitionString.getString(PropertyValue)public String getString(PropertyValue stringProperty) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionStringReturns the value of the given string property as a Java string.
getString in interface TypeDefinitionStringstringProperty - 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.public PropertyValue[] getPropertyValues(PropertyValue stringProperty) throws NullPointerException, IllegalPropertyValueException, BadSizeException
TypeDefinitionStringReturns 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 TypeDefinitionString.getElementType().
getPropertyValues in interface TypeDefinitionStringstringProperty - 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.TypeDefinitionString.appendElements(PropertyValue, PropertyValue[])@MediaProperty(uuid1=100729095, uuid2=3840, uuid3=0, uuid4={6,14,43,52,1,1,1,2}, definedName="StringElementType", aliases="ElementType", typeName="TypeDefinitionWeakReference", optional=false, uniqueIdentifier=false, pid=27, symbol="StringElementType") public TypeDefinition getElementType()
TypeDefinitionStringReturns the underlying AAF type used to represent characters of a string of this string type definition.
getElementType in interface TypeDefinitionString@MediaPropertySetter(value="StringElementType") public void setElementType(TypeDefinition type) throws NullPointerException, IllegalArgumentException
Set the underlying array element type of this string type definition. The element type
must either be a integer type definition or
a character type definition,
otherwise a IllegalArgumentException will be thrown.
type - Underlying array element type of this string type definition.NullPointerException - Argument is null.IllegalArgumentException - The given type definition is not of integer or character
type.public static final TypeDefinition initializeStringElementType()
public void appendString(PropertyValue stringProperty, String extension) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionStringAppends 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 TypeDefinitionString.getCharacterSet(). An attempt to
pass a null string will result in no change to the property
value and no error.
appendString in interface TypeDefinitionStringstringProperty - 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.TypeDefinitionString.appendString(PropertyValue, Buffer),
TypeDefinitionString.appendElements(PropertyValue, PropertyValue[])public PropertyValue createValueFromString(String initData)
TypeDefinitionStringCreate 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 TypeDefinitionString.getCharacterSet(). Setting
a null value will result in the return of a property
value with its internal string representation set to
null.
createValueFromString in interface TypeDefinitionStringinitData - Initial string data to create a new string
property value.TypeDefinitionString.createValueFromString(Buffer)public PropertyValue createValueFromString(Buffer initData) throws IllegalArgumentException
TypeDefinitionStringCreate 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 TypeDefinitionString.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.
createValueFromString in interface TypeDefinitionStringinitData - 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.TypeDefinitionString.createValueFromString(Buffer)public String getCharacterSet()
TypeDefinitionStringReturns 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".
getCharacterSet in interface TypeDefinitionStringCharsetpublic void setCharacterSet(String charSet) throws NullPointerException, IllegalCharsetNameException
TypeDefinitionStringSet 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.
setCharacterSet in interface TypeDefinitionStringcharSet - Character set used for conversion between this string type and Java strings.NullPointerException - The given character set name is null.IllegalCharsetNameExceptionCharsetpublic void setString(PropertyValue stringProperty, String data) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionStringSet 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 TypeDefinitionString.getCharacterSet(). Setting
a null value will result in the return of a property
value with its internal string representation set to
null.
setString in interface TypeDefinitionStringstringProperty - 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.TypeDefinitionString.getString(PropertyValue),
TypeDefinitionString.setString(PropertyValue, Buffer)public void setString(PropertyValue stringProperty, Buffer data) throws NullPointerException, IllegalPropertyValueException, IllegalArgumentException
TypeDefinitionStringSet 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 TypeDefinitionString.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.
setString in interface TypeDefinitionStringstringProperty - 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.TypeDefinitionString.getElements(PropertyValue),
TypeDefinitionString.setString(PropertyValue, String)public void appendString(PropertyValue stringProperty, Buffer extension) throws NullPointerException, IllegalArgumentException, IllegalPropertyValueException
TypeDefinitionStringAppends 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 TypeDefinitionString.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 TypeDefinitionString.appendElements(PropertyValue, Buffer).
appendString in interface TypeDefinitionStringstringProperty - 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.TypeDefinitionString.appendElements(PropertyValue, PropertyValue[]),
TypeDefinitionString.appendString(PropertyValue, String)public TypeCategory getTypeCategory()
TypeDefinitionReturns the type category to which this type definition belongs, which
corresponds to its sub interface. For example, TypeCategory.Int
is returned for a TypeDefinitionInteger.
getTypeCategory in interface TypeDefinitiongetTypeCategory in class TypeDefinitionImplTypeCategorypublic PropertyValue createValue(Object javaValue) throws ClassCastException
TypeDefinitionImplCreate a property value from the given Java object. If the type of
the object is not compatible with this type definition, a ClassCastException
is thrown.
createValue in interface TypeDefinitioncreateValue in class TypeDefinitionImpljavaValue - Java object to use to create a property value of this type.ClassCastException - The given object cannot be cast to a property value with
this type definition.public PropertyValue createFromBytes(ByteBuffer buffer)
TypeDefinitionCreate a value of this type by reading the bytes in the given byte buffer. The buffer is assumed to have exactly the number of bytes that represent the value. For example, the length of a string value will be determined by the length (remaining bytes) in the buffer and not by reading a length value from the buffer.
This method is able to read values written by the
TypeDefinition.writeAsBytes(PropertyValue, ByteBuffer) method.
createFromBytes in interface TypeDefinitioncreateFromBytes in class TypeDefinitionImplbuffer - Buffer to create a value from.TypeDefinition.writeAsBytes(PropertyValue, ByteBuffer),
TypeDefinition.lengthAsBytes(PropertyValue)public long lengthAsBytes(PropertyValue value) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionReturns the number of bytes that the given value of this type is serialized as a sequence of bytes.
The number returned by this method is the same as the number of bytes written
to a byte buffer by the TypeDefinition.writeAsBytes(PropertyValue, ByteBuffer) method.
lengthAsBytes in interface TypeDefinitionlengthAsBytes in class TypeDefinitionImplvalue - Value to find the length of when serialized to bytes.NullPointerException - Cannot compute the serialized length of a null value.IllegalPropertyValueException - The given property value is not of this type.TypeDefinition.writeAsBytes(PropertyValue, ByteBuffer),
TypeDefinition.createFromBytes(ByteBuffer)public List<PropertyValue> writeAsBytes(PropertyValue value, ByteBuffer buffer) throws NullPointerException, IllegalPropertyValueException, InsufficientSpaceException
TypeDefinitionWrite the given property value of this type to the given byte stream. This version is most appropriate for writing KLV streams (MXF files).
The format used to serialize the value with be compatible with the
TypeDefinition.createFromBytes(ByteBuffer) method. The number of bytes written to
the byte buffer will be the same as returned by TypeDefinition.lengthAsBytes(PropertyValue).
writeAsBytes in interface TypeDefinitionwriteAsBytes in class TypeDefinitionImplvalue - Value to write to the given buffer.buffer - Buffer to write the value to.NullPointerException - Cannot write from a null property value and/or
to a null value.IllegalPropertyValueException - The given property value is not of this type.InsufficientSpaceException - Insufficient space to write the given value into the
given buffer.TypeDefinition.writeAsStructuredStorageBytes(PropertyValue, ByteBuffer),
TypeDefinition.createFromBytes(ByteBuffer),
TypeDefinition.lengthAsBytes(PropertyValue)public void appendMetadictXML(Node metadict, String namespace, String prefix)
MetaDefinitionAppend an XML representation of this meta definition to the given XML node.
appendMetadictXML in interface MetaDefinitionappendMetadictXML in class MetaDefinitionImplmetadict - Meta dictionary node to append a description of this node to.CommonConstants.AAF_METADICT_NAMESPACEpublic TypeDefinitionString clone()
MetaDefinitionCreate a cloned copy of this meta definition.
clone in interface MetaDefinitionclone in interface TypeDefinitionclone in interface TypeDefinitionStringclone in class TypeDefinitionImpl(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.