JSR-043: JTAPI-1.4

javax.telephony.media.container
Interface DataObject

All Superinterfaces:
CoderConstants, ContainerConstants
All Known Subinterfaces:
Async_DataObject

public interface DataObject
extends ContainerConstants

An open Media Data Object, as returned by ContainerService.openDataObject().

An open DataObject can be used to read/write data. These are not used directly for play() and record(). Data written using DataObject.write() can be played by passing the String name of the MDO to play().

Since:
JTAPI-1.4

Fields inherited from interface javax.telephony.media.container.ContainerConstants
b_Append, b_Create, b_Exclusive, b_Truncate, e_OK, k_InputParameters, k_MediaType, k_MediaTypes, v_AccessCopy, v_AccessRead, v_AccessWrite, v_Begin, v_Bytes, v_Create, v_Current, v_End, v_Fail, v_MDO, v_MilliSeconds
 
Fields inherited from interface javax.telephony.media.CoderConstants
v_24kADPCM, v_32kADPCM, v_44kADPCM, v_48k8BitLinear, v_48kALawPCM, v_48kMuLawPCM, v_64k8BitLinear, v_64kALawPCM, v_64kMuLawPCM, v_88k8BitLinear, v_88kALawPCM, v_88kMuLawPCM, v_ADPCM_24k, v_ADPCM_32k, v_ADPCM_44k, v_ADSI, v_ALawPCM_48k, v_ALawPCM_64k, v_ALawPCM_88k, v_ASCII, v_Linear8Bit_48k, v_Linear8Bit_64k, v_Linear8Bit_88k, v_MuLawPCM_48k, v_MuLawPCM_64k, v_MuLawPCM_88k, v_TDD
 
Method Summary
 void close()
          close this DataObject.
 ContainerService getContainerService()
          Return the ContainerService for this DataObject.
 Symbol getMediaType()
          The assigned coder type for an existing DataObject.
 byte[] read(int nbytes)
          read bytes from this DataObject and return them.
 int seek(Symbol position, int offset, Symbol seekUnits)
          set stream to new position.
 void write(byte[] bytes)
          write the whole byte[].
 void write(byte[] bytes, int offset, int len)
          write from within a byte[].
 

Method Detail

getContainerService

public ContainerService getContainerService()
Return the ContainerService for this DataObject.
Returns:
the ContainerService for this DataObject.

getMediaType

public Symbol getMediaType()
The assigned coder type for an existing DataObject.
Returns:
the assigned coder type for the DataObject.

close

public void close()
           throws ContainerException
close this DataObject.
Throws:
ContainerException - if close fails

seek

public int seek(Symbol position,
                int offset,
                Symbol seekUnits)
         throws ContainerException
set stream to new position.

First move to the indicated position, one of v_Begin, v_Current, v_End. Then translate offset and seekUnits and skip the appropriate number of bytes forward or backward from there.

If offset is negative, then seek backward from position toward beginning of MDO.

Returns the number of bytes actually skipped (from the position). [althought for some seekUnits, that may not be very meaningful]

Parameters:
position - one of the Symbols v_Begin, v_End, v_Current.
offset - int number of units to move from position.
seekUnits - one of the Symbols v_Bytes, v_MilliSeconds, v_MDO
Returns:
int number of bytes moved by the seek after going to position.
Throws:
ContainerException - if seek fails

read

public byte[] read(int nbytes)
            throws ContainerException
read bytes from this DataObject and return them.
Parameters:
nbytes - the int number of bytes to read
Returns:
an array of the bytes read
Throws:
ContainerException - if the bytes are not read

write

public void write(byte[] bytes,
                  int offset,
                  int len)
           throws ContainerException
write from within a byte[].
Parameters:
bytes - a byte array containing the bytes to write
offset - int index of the first byte to write
len - int number of bytes to write
Throws:
ContainerException - if the bytes are not written

write

public void write(byte[] bytes)
           throws ContainerException
write the whole byte[]. Equivalent to write(bytes, 0, bytes.length)
Parameters:
bytes - a byte array containing the bytes to write
Throws:
ContainerException - if the bytes are not written

JSR-043: JTAPI-1.4

Send comments to: JSR-43@ectf.org