|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tv.amwa.maj.meta.MetaDefinition tv.amwa.maj.meta.TypeDefinition tv.amwa.maj.meta.TypeDefinitionStream
@AAFClass(uuid1=218169601, uuid2=524, uuid3=0, uuid4={6,14,43,52,2,6,1,1}, definedName="TypeDefinitionStream", description="The TypeDefinitionStream class defines a property type that is stored in a stream and has a value that consists of a varying number of the bytes.") public final class TypeDefinitionStream
Implements the definition of a property type that is stored in a stream and has a value that consists of a varying number of the bytes.
THE COMMENTS FOR THIS CLASS ARE INCOMPLETE.
Nested Class Summary | |
---|---|
static class |
TypeDefinitionStream.StreamValue
|
static class |
TypeDefinitionStream.XMLHandler
|
Field Summary | |
---|---|
static TypeDefinitionStream |
DataValue
|
static TypeDefinitionStream |
Stream
|
Constructor Summary | |
---|---|
TypeDefinitionStream(AUID identification,
String typeName)
Creates and initializes a new type definition for a streams, which defines a property type that is stored in a stream and has a value that consists of a varying number of the bytes. |
Method Summary | |
---|---|
void |
append(PropertyValue streamProperty,
byte[] data)
Extend the given stream property value using the data from the given data buffer, an array of bytes. |
void |
appendElements(PropertyValue streamProperty,
TypeDefinition elementType,
PropertyValue[] data)
Append the elements of the given property value array onto the end of the given stream property value. |
void |
appendXMLChildren(Node parent)
Append child elements to the given parent node to serialize the value of an object to an XML fragment. |
void |
clearStoredByteOrder(PropertyValue streamProperty)
Clear the stored byte order of the given stream property value. |
PropertyValue |
createValue(Object javaValue)
Create a property value from the given Java object. |
long |
getPosition(PropertyValue streamProperty)
Returns the current position within the given stream property value. |
long |
getSize(PropertyValue streamProperty)
Returns the number of bytes in the given stream property value, or -1 if the stream is null . |
ByteOrder |
getStoredByteOrder(PropertyValue streamProperty)
Returns the stored byte order of the given stream property value. |
TypeCategory |
getTypeCategory()
Returns the type category to which this type definition belongs, which corresponds to its sub interface. |
boolean |
hasStoredByteOrder(PropertyValue streamProperty)
Returns true if the given property value
stream has a stored byte order; otherwise false . |
byte[] |
read(PropertyValue streamProperty,
int dataSize)
Copies the data from the current position in the given stream property value into a data buffer, which is of the given size. |
PropertyValue[] |
readElements(PropertyValue streamProperty,
TypeDefinition elementType,
int numElements)
Reads the given number of elements from the given stream property value of the given element type and returns them as an array of property values. |
void |
setPosition(PropertyValue streamProperty,
long newPosition)
Sets the position of the given stream property value to that of the given value. |
void |
setPropertiesFromInterface(TypeDefinitionStream castFrom)
|
void |
setSize(PropertyValue streamProperty,
long newSize)
Sets the number of bytes contained in the given stream property value to the given new size. |
void |
setStoredByteOrder(PropertyValue streamProperty,
ByteOrder byteOrder)
Sets the stored byte order of the given stream property value to the given byte order. |
void |
write(PropertyValue streamProperty,
byte[] data)
Write the given data buffer, an array of bytes, into the given stream property value and its current position. |
void |
writeElements(PropertyValue streamProperty,
TypeDefinition elementType,
PropertyValue[] data)
Writes the elements of the given array of property values of the given element type into the given stream property value at its current position. |
Methods inherited from class tv.amwa.maj.meta.TypeDefinition |
---|
setPropertiesFromInterface |
Methods inherited from class tv.amwa.maj.meta.MetaDefinition |
---|
castFromInterface, deepEquals, equals, getAUID, getDescription, getIdentification, getName, hashCode, setDescription, setName, setPropertiesFromInterface, toString |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface tv.amwa.maj.iface.MetaDefinition |
---|
getAUID, getDescription, getName, setDescription, setName |
Methods inherited from interface tv.amwa.maj.meta.MAJCommon |
---|
equals, hashCode, toString |
Field Detail |
---|
public static final TypeDefinitionStream Stream
public static final TypeDefinitionStream DataValue
Constructor Detail |
---|
public TypeDefinitionStream(AUID identification, @AAFString String typeName) throws NullPointerException
Creates and initializes a new type definition for a streams, which defines a property type that is stored in a stream and has a value that consists of a varying number of the bytes. The order of the bytes is meaningful.
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
AAFFactory.typeDefinitionForName(String)
or
AAFFactory.typeDefinitionForIdentification(tv.amwa.maj.record.AUID)
respectively.
identification
- AUID to be used to identify this stream type.typeName
- Friendly name for this type definition.
NullPointerException
- The identification argument is null
.Method Detail |
---|
public final void setPropertiesFromInterface(TypeDefinitionStream castFrom)
MetaDefinition.setPropertiesFromInterface(tv.amwa.maj.iface.MetaDefinition)
public void append(PropertyValue streamProperty, byte[] data) throws NullPointerException, IllegalPropertyValueException, DataSizeException
TypeDefinitionStream
Extend the given stream property value using the data from the given data buffer, an array of bytes. The size of the stream will increase by the size of the given data buffer.
append
in interface TypeDefinitionStream
streamProperty
- Stream property value to extend
the given data buffer.data
- Data buffer to use to extend the given stream
property value.
NullPointerException
- One or both of the arguments is/are null
.
IllegalPropertyValueException
- The given property value is
not defined by this stream type definition.
DataSizeException
- Not enough space was available to extend
the given stream property value by the given number of bytes.public void appendElements(PropertyValue streamProperty, TypeDefinition elementType, PropertyValue[] data) throws NullPointerException, IllegalPropertyValueException, BadTypeException, DataSizeException
TypeDefinitionStream
Append the elements of the given property value array onto the end of the given stream property value. All the elements of the given property value array must by of the given type.
appendElements
in interface TypeDefinitionStream
streamProperty
- Stream property value to append elements
to the end of.elementType
- Type of the elements of data to append.data
- Property values of the elements to append onto
the given stream property value.
NullPointerException
- One or more of the arguments is
null
, or one or more of the given data values in null
.
IllegalPropertyValueException
- The given property value is
not defined by this stream type definition.
BadTypeException
- One or more of the elements of the data
array are not defined by the given element type.
DataSizeException
- The operation failed because not enough
space was available to extend the stream.public void clearStoredByteOrder(PropertyValue streamProperty) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionStream
Clear the stored byte order of the given stream property value. The stream should be empty before calling this method to avoid a mixture of byte orders within the stream.
clearStoredByteOrder
in interface TypeDefinitionStream
streamProperty
- Stream property value to clear the stored
property value of.
NullPointerException
- The given stream property value is null
.
IllegalPropertyValueException
- The given property value is
not defined by this stream type definition.public long getPosition(PropertyValue streamProperty) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionStream
Returns the current position within the given stream property value.
getPosition
in interface TypeDefinitionStream
streamProperty
- Stream property value to find the current position of.
NullPointerException
- The given stream property value is null
.
IllegalPropertyValueException
- The given property value is
not defined by this stream type definition.public long getSize(PropertyValue streamProperty) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionStream
Returns the number of bytes in the given stream property
value, or -1 if the stream is null
.
getSize
in interface TypeDefinitionStream
streamProperty
- Stream property value containing the
stream to determine the length of.
NullPointerException
- The given stream property value is null
.
IllegalPropertyValueException
- The given property value is not
defined by this stream type definition.public ByteOrder getStoredByteOrder(PropertyValue streamProperty) throws NullPointerException, IllegalPropertyValueException, PropertyNotPresentException
TypeDefinitionStream
Returns the stored byte order of the given stream property value.
getStoredByteOrder
in interface TypeDefinitionStream
streamProperty
- Stream property value to find the byte order
for.
NullPointerException
- The given stream proeprty value is null
.
IllegalPropertyValueException
- The given property value is
not defined by this stream type definition.
PropertyNotPresentException
- The byte order is not stored
in the given property value.public boolean hasStoredByteOrder(PropertyValue streamProperty) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionStream
Returns true
if the given property value
stream has a stored byte order; otherwise false
.
hasStoredByteOrder
in interface TypeDefinitionStream
streamProperty
- Stream property value to test.
NullPointerException
- The given stream property value is null
.
IllegalPropertyValueException
- The given property value is
not defined by this stream type definition.public byte[] read(PropertyValue streamProperty, int dataSize) throws NullPointerException, IllegalArgumentException, EndOfDataException, IllegalPropertyValueException
TypeDefinitionStream
Copies the data from the current position in the given stream property value into a data buffer, which is of the given size. The data buffer is a byte array that is returned by the method.
read
in interface TypeDefinitionStream
streamProperty
- Stream property array to copy data from.dataSize
- Size of the data buffer to create and return.
NullPointerException
- The given stream property value is null
.
IllegalArgumentException
- Cannot read a negative number of bytes
from a stream property value.
EndOfDataException
- Cannot read the requested amount of data as not
enough bytes remain in the given stream property value at its current position.
IllegalPropertyValueException
- The given property value is
not defined by this stream type definition.public PropertyValue[] readElements(PropertyValue streamProperty, TypeDefinition elementType, int numElements) throws NullPointerException, IllegalPropertyValueException, BadTypeException, EndOfDataException
TypeDefinitionStream
Reads the given number of elements from the given stream property value of the given element type and returns them as an array of property values. The read takes place at the current position for the given stream property value and advances the position by the number of bytes read.
If the TypeDefinitionStream.writeElements(PropertyValue, TypeDefinition, PropertyValue[])
method has been used to write an array of property values to a stream
property value at a given position, a read from the same position with this
method must create an array containing the same values.
readElements
in interface TypeDefinitionStream
streamProperty
- Stream property value to read elements from.elementType
- Type of elements to read from the given stream
property value.numElements
- Number of elements to read from the given stream
property value.
NullPointerException
- One or both of the stream property or element
type arguments is/are null
.
IllegalPropertyValueException
- The given property value is
not defined by this stream type definition.
BadTypeException
- The values in the data stream do not match
the given element type.
EndOfDataException
- Reading the number of requested elements
will result in a read beyond the end of the given stream property
value.TypeDefinitionStream.writeElements(PropertyValue, TypeDefinition, PropertyValue[])
public void setPosition(PropertyValue streamProperty, long newPosition) throws NullPointerException, IllegalArgumentException, IllegalPropertyValueException
TypeDefinitionStream
Sets the position of the given stream property value to that of the given value.
setPosition
in interface TypeDefinitionStream
streamProperty
- Stream property value to have its
position set.newPosition
- New position to set for the given stream
property value.
NullPointerException
- The given stream property value is null
.
IllegalArgumentException
- The given position is outside
the acceptable range for the given stream property.
IllegalPropertyValueException
- The given property value is
not defined by this stream type definition.public void setSize(PropertyValue streamProperty, long newSize) throws NullPointerException, IllegalArgumentException, IllegalPropertyValueException
TypeDefinitionStream
Sets the number of bytes contained in the given stream
property value to the given new size. If the new size is smaller
than the current size, as returned by TypeDefinitionStream.getSize(PropertyValue)
,
then the data will be truncated. If the size is larger, the beginning
section of the stream value will be the same as the existing stream.
setSize
in interface TypeDefinitionStream
streamProperty
- Stream property value that is to have
a new size.newSize
- New size, measured in bytes, for the given
stream property value.
NullPointerException
- The given stream property value is null
.
IllegalPropertyValueException
- The given property value is not
defined by this stream type definition.
IllegalArgumentException
public void setStoredByteOrder(PropertyValue streamProperty, ByteOrder byteOrder) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionStream
Sets the stored byte order of the given stream property value to the given byte order. The stream should be empty before calling this method to avoid a mixture of byte orders within the stream.
setStoredByteOrder
in interface TypeDefinitionStream
streamProperty
- Stream property value to set the stored
byte order for.byteOrder
- Byte order to set for the given stream property value.
NullPointerException
- One or both of the arguments is/are null
.
IllegalPropertyValueException
- The given property value is
not defined by this stream type definition.public void write(PropertyValue streamProperty, byte[] data) throws NullPointerException, IllegalPropertyValueException, EndOfDataException
TypeDefinitionStream
Write the given data buffer, an array of bytes, into the given stream property value and its current position. The number of bytes written is the same as the size of the given data buffer.
write
in interface TypeDefinitionStream
streamProperty
- Stream property value to have data written into
at its current position.data
- Data to write into the given stream property value at its
current position.
NullPointerException
- One or both of the arguments is/are null
.
IllegalPropertyValueException
- The given property value is
not defined by this stream type definition.
EndOfDataException
- The write operation will exceed the current
size of the stream.public void writeElements(PropertyValue streamProperty, TypeDefinition elementType, PropertyValue[] data) throws NullPointerException, IllegalPropertyValueException, BadTypeException, EndOfDataException
TypeDefinitionStream
Writes the elements of the given array of property values of the given element type into the given stream property value at its current position.
writeElements
in interface TypeDefinitionStream
streamProperty
- Stream property value into which elements
are to be written.elementType
- Type of elements to be written to the given
stream property value.data
- Elements to write to the given stream property value
at its current position.
NullPointerException
- One or more of the arguments is null
,
or one or more of the data elements is null
.
IllegalPropertyValueException
- The given property value is
not defined by this stream type definition.
BadTypeException
- One or more of the elements of the data
array are not defined by the given element type.
EndOfDataException
- The end of the stream has been reached
before all data values could be written. The stream is returned
to its previous state.TypeDefinitionStream.readElements(PropertyValue, TypeDefinition, int)
public PropertyValue createValue(Object javaValue) throws ClassCastException
TypeDefinition
Create 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 TypeDefinition
createValue
in class TypeDefinition
javaValue
- 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 TypeCategory getTypeCategory()
TypeDefinition
Returns 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 TypeDefinition
getTypeCategory
in class TypeDefinition
TypeCategory
public void appendXMLChildren(Node parent)
XMLSerializable
Append child elements to the given parent node to serialize the value of an object
to an XML fragment. Methods of the XMLBuilder
class are provided to help with this
process.
appendXMLChildren
in interface XMLSerializable
appendXMLChildren
in class MetaDefinition
parent
- XML parent element to append child nodes to.
|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |