Oracle interMedia Audio, Image, and Video Java Classes User's Guide and Reference
Release 8.1.7

Part Number A85374-01

Library

Product

Contents

Index

Go to previous page Go to next page

3
ORDAudio Reference Information

interMedia Java Classes describes the ORDAudio object type, which supports the storage and management of audio data.

Methods invoked at the ORDAudio level that are handed off for processing to the database source plug-in or database format plug-in have byte[ ] ctx[ ] as a context parameter. In cases where a client system is connecting to a database server, the space for the parameter is created by the client (in the reference examples, 4000 bytes of space), but the content of the context parameter is generated by the server. The context parameter is passed from the client to the server for the processing of context information.


Note:

In the current release, not all source plug-ins or format plug-ins will use or generate the context parameter, but if you include the parameter as previously described, your application should work with any current or future source plug-ins or format plug-ins. 


3.1 Prerequisites

You will need to include the following import statements in your Java file in order to run interMedia methods:

import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.*;
import oracle.sql.*;
import oracle.ord.im.*;

The examples in this reference chapter are based on the assumption that the following operations have already been performed:

For examples of making a connection and populating a local object, see Section 2.1.2.

3.2 Reference Information

This section presents reference information on the methods that operate on ORDAudio objects.


checkProperties( )

Format

public boolean checkProperties(byte[ ] ctx[ ])

Description

Checks if the properties stored in the media data of the local object are consistent with the attributes of the local object.

Parameters

ctx[ ]

The format plug-in context information. It is set to NULL if there is no context information.

Return Value

This method returns TRUE if the attribute values stored in the object attributes are the same as the properties stored in the BLOB data; FALSE otherwise.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1];
if(audObj.checkProperties(ctx))
     System.out.println("checkProperties successful");

where:


clearLocal( )

Format

public void clearLocal( )

Description

Clears the source local field of the application ORDAudio object.

Parameters

None.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.clearLocal( )


closeSource( )

Format

public int closeSource(byte[ ] ctx[ ])

Description

Closes the ORDAudio file source.

Parameters

ctx[ ]

The source plug-in context information. It is set to NULL if there is no context information.

Return Value

This method returns 0 if the operation is successful, or an integer greater than 0 in case of failure.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1];
int i = audObj.closeSource(ctx);
if(i == 0)
     System.out.println("Source close successful");
else
     System.out.println("Source close unsuccessful");

where:


deleteContent( )

Format

public void deleteContent( )

Description

Deletes the media data in the BLOB in the application ORDAudio object.

Parameters

None.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.deleteContent( );


export( )

Format

public void export (byte[ ] ctx[ ], String sourceType, String sourceLocation, String sourceName)

Description

Exports the data from the application ORDAudio object BLOB to the location specified in the parameters. The location is of the form:

sourceType://sourceLocation/sourceName

This method will only work if you are running Oracle8i database server version 8.1.7 or later.

See Chapter 4 of Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.

Parameters

ctx[ ]

The source plug-in context information. It is set to NULL if there is no context information.

sourceType

The source type to which the content will be exported. Only FILE is natively supported.

sourceLocation

The location on the database server to which the content will be exported.

sourceName

The name of the source to which the content will be exported.

Return Value

None.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1];
audObj.export(ctx,"FILE","AUDIODIR","complete.wav");

where:


getAllAttributes( )

Format

public CLOB getAllAttributes(byte[ ] ctx[ ])

Description

Gets all the attributes from the application ORDAudio object and puts them in a CLOB.

Parameters

ctx[ ]

The format plug-in context information. It is set to NULL if there is no context information.

Return Value

This method returns a CLOB that contains the attribute values of the ORDAudio object.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1];
CLOB attributes = audObj.getAllAttributes(ctx);

where:


getAttribute( )

Format

public String getAttribute(byte[ ] ctx[ ], String name)

Description

Gets the value of a specified attribute from the application ORDAudio object as a String.

Parameters

ctx[ ]

The format plug-in context information. It is set to NULL if there is no context information.

name

The name of the attribute.

Return Value

This method returns the value of the specified attribute, as a String.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1];
int attribute = audObj.getAttribute(ctx,"numberOfChannels")

where:


getAudioDuration( )

Format

public int getAudioDuration( )

Description

Gets the audio duration of the application ORDAudio object.

Parameters

None.

Return Value

This method returns the audio duration of the ORDAudio object, in seconds.

Exceptions

java.sql.SQLException

Example

int audioDuration = audObj.getAudioDuration( );


getBFILE( )

Format

public oracle.sql.BFILE getBFILE( )

Description

Gets the BFILE attribute of the application ORDAudio object.

Parameters

None.

Return Value

This method returns the BFILE.

Exceptions

java.sql.SQLException

Example

BFILE audioBFILE = audObj.getBFILE( );


getComments( )

Format

public oracle.sql.CLOB getComments( )

Description

Gets the comments from the application ORDAudio object and puts them in a CLOB.

Parameters

None.

Return Value

This method returns a CLOB that contains the comments from the ORDAudio object.

Exceptions

java.sql.SQLException

Example

CLOB comments = audObj.getComments( )


getCompressionType( )

Format

public String getCompressionType( )

Description

Gets the compression type of the application ORDAudio object as a String.

Parameters

None.

Return Value

This method returns the compression type of the ORDAudio object, as a String.

Exceptions

java.sql.SQLException

Example

String compressionType = audObj.getComressionType( );


getContent( )

Format

public oracle.sql.BLOB getContent( )

Description

Gets the LOB locator from the application ORDAudio object.

Parameters

None.

Return Value

This method returns the LOB locator of the application ORDAudio object.

Exceptions

java.sql.SQLException

Example

BLOB localContent = audObj.getContent( );


getContentInLob( )

Format

public BLOB getContentInLob(byte[ ] ctx[ ], String mimetype[ ], String format[ ])

Description

Gets the content of the application ORDAudio object and puts it in a BLOB.

Parameters

ctx[ ]

The source plug-in context information. It is set to NULL if there is no context information.

mimetype[ ]

The MIME type of the content returned, stored in mimetype[0].

format[ ]

The format of the content returned, stored in format[0].

Return Value

This method returns the LOB content of the application ORDAudio object in a LOB locator.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1];
String mimeType[ ] = new String[1];
mimeType[0] = "video/x-msvideo"
String format[ ] = new String[1];
format[0] = "RIFF"
BLOB localContent = audObj.getContentInLob(ctx,mimeType,format);

where:


getContentLength( )

Format

public int getContentLength( )

Description

Gets the content length of the media data in the application ORDAudio object.

Parameters

None.

Return Value

This method returns the content length of the media data.

Exceptions

java.sql.SQLException

Example

int contentLength = audObj.getContentLength( );


getContentLength(byte[ ][ ])

Format

public int getContentLength(byte[ ] ctx[ ])

Description

Gets the content length of the media data in the application ORDAudio object.

Parameters

ctx[ ]

The source plug-in context information. It is set to NULL if there is no context information.

Return Value

This method returns the content length of the media data.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1];
int contentLength = audObj.getContentLength(ctx);

where:


getDataInByteArray( )

Format

public byte[ ] getDataInByteArray( )

Description

Gets data from the LOB locator of the application ORDAudio object and puts it in a local byte array.

Parameters

None.

Return Value

This method returns the byte array from which the data will be read.

Exceptions

java.sql.SQLException

java.io.IOException

java.lang.OutOfMemoryError

Example

byte[ ] byteArr = audObj.getDataInByteArray( );


getDataInFile( )

Format

public boolean getDataInFile(String filename)

Description

Gets data from the LOB locator of the application ORDAudio object and puts it in a local file.

Parameters

filename

The name of the file into which the data will be loaded.

Return Value

This method returns TRUE if loading is successful; FALSE otherwise.

Exceptions

java.sql.SQLException

java.io.IOException

Example

boolean load = audObj.getDataInFile("output1.dat");
if(load)
     System.out.println("getDataInFile completed successfully");
else
     System.out.println("Error in getDataInFile");

where:


getDataInStream( )

Format

public InputStream getDataInStream( )

Description

Gets data from the LOB locator of the application ORDAudio object and puts it in a local input stream.

Parameters

None.

Return Value

This method returns the input stream from which the data will be read.

Exceptions

java.sql.SQLException

Example

InputStream inpStream = audObj.getDataInStream( );


getDescription( )

Format

public String getDescription( )

Description

Gets the description attribute of the application ORDAudio object.

Parameters

None.

Return Value

This method returns the description attribute as a String.

Exceptions

java.sql.SQLException

Example

String desc = audObj.getDescription( );


getEncoding( )

Format

public String getEncoding( )

Description

Gets the encoding of the application ORDAudio object as a String.

Parameters

None.

Return Value

This method returns the encoding of the ORDAudio object as a String.

Exceptions

java.sql.SQLException

Example

String encoding = audObj.getEncoding( );

getFormat( )

Format

public String getFormat( )

Description

Gets the format attribute of the application ORDAudio object as a String.

Parameters

None.

Return Value

This method returns the format attribute as a String.

Exceptions

java.sql.SQLException

Example

String format = audObj.getFormat( );


getMimeType( )

Format

public String getMimeType( )

Description

Gets the MIME type of the application ORDAudio object as a String.

Parameters

None.

Return Value

This method returns the MIME type of the ORDAudio object as a String.

Exceptions

java.sql.SQLException

Example

String mimeType = audObj.getMimeType( );


getNumberOfChannels( )

Format

public int getNumberOfChannels( )

Description

Gets the number of channels in the application ORDAudio object.

Parameters

None.

Return Value

This method returns the number of channels in the ORDAudio object as an integer.

Exceptions

java.sql.SQLException

Example

int channels = audObj.getNumberOfChannels( );


getSampleSize( )

Format

public int getSampleSize( )

Description

Gets the sample size of the application ORDAudio object as an integer.

Parameters

None.

Return Value

This method returns the sample size of the ORDAudio object.

Exceptions

java.sql.SQLException

Example

int sampleSize = audObj.getSampleSize( );

getSamplingRate( )

Format

public int getSamplingRate( )

Description

Gets the sampling rate of the application ORDAudio object as an integer.

Parameters

None.

Return Value

This method returns the sampling rate of the ORDAudio object in bytes per second.

Exceptions

java.sql.SQLException

Example

int samplingRate = audObj.getSamplingRate( );


getSource( )

Format

public String getSource( )

Description

Gets the object source information of the application ORDAudio object, including the source location, name, and type.

Parameters

None.

Return Value

This method returns a String containing the object source information.

Exceptions

java.sql.SQLException

Example

String source = audObj.getSource( );


getSourceLocation( )

Format

public String getSourceLocation( )

Description

Gets the source location of the application ORDAudio object as a String.

Parameters

None.

Return Value

This method returns a String containing the object source location.

Exceptions

java.sql.SQLException

Example

String location = audObj.getSourceLocation( );


getSourceName( )

Format

public String getSourceName( )

Description

Gets the source name of the application ORDAudio object as a String.

Parameters

None.

Return Value

This method returns a String containing the object source name.

Exceptions

java.sql.SQLException

Example

String name = audObj.getSourceName( );


getSourceType( )

Format

public String getSourceType( )

Description

Gets the source location of the application ORDAudio object as a String.

Parameters

None.

Return Value

This method returns a String containing the object source type.

Exceptions

java.sql.SQLException

Example

String type = audObj.getSourceType( );


getUpdateTime( )

Format

public java.sql.Timestamp getUpdateTime( )

Description

Gets a Timestamp object that contains information on when the application ORDAudio object was most recently updated.

Parameters

None.

Return Value

This method returns a Timestamp object that contains the time of the most recent update.

Exceptions

java.sql.SQLException

Example

Timestamp time = audObj.getUpdateTime( );


importData( )

Format

public void importData(byte[ ] ctx[ ])

Description

Imports data from an external source into the application ORDAudio object.

The srcType, srcLocation, and srcName attributes must all be defined for this method to work.

Parameters

ctx[ ]

The source plug-in context information. It is set to NULL if there is no context information.

Return Value

None.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1];
audObj.importData(ctx);

where:


importFrom( )

Format

public void importFrom(byte[ ] ctx[ ], String sourceType, String sourceLocation, String sourceName)

Description

Imports data from an external source into the application ORDAudio object. The location of the external source is of the form:

sourceType://sourceLocation/sourceName

Parameters

ctx[ ]

The source plug-in context information. See Chapter 4 of Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.

sourceType

The source type from which the data will be imported.

sourceLocation

The source location on the database server from which the data will be imported.

sourceName

The source name from which the data will be imported.

Return Value

None.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1];
audObj.importFrom("FILE","AUDIODIR","testaud.dat");

where:


isLocal( )

Format

public boolean isLocal( )

Description

Checks if the application ORDAudio object local attribute is set.

Parameters

None.

Return Value

This method returnsTRUE if the ORDAudio object local attribute is set; FALSE otherwise.

Exceptions

java.sql.SQLException

Example

if(audObj.isLocal( ))
     System.out.println("local attribute is set to true");
else
     System.out.println("lcoal attribute is set to false");


loadDataFromByteArray( )

Format

public boolean loadDataFromByteArray(byte[ ] byteArr)

Description

Loads data from the local byte buffer into the database ORDAudio object LOB locator and into the application object. It also calls setLocal( ), which sets the local field of the application ORDAudio object, but not the database object, and setUpdateTime(null), which sets the updateTime attribute to the SYSDATE of the database server.

Parameters

byteArr

The name of the local byte array from which the data will be loaded.

Return Value

This method returns TRUE if loading is successful; FALSE otherwise.

Exceptions

java.sql.SQLException

java.io.IOException

Example

byte[ ] data = new byte[32000];
FileInputStream fStream = new FileInputStream("testaud.dat");
fStream.read(data,0,32300);
boolean success = audObj.loadDataFromByteArray(data);
if(success)
     System.out.println("loadDataFromByteArray was successful");
else
     System.out.println("loadDataFromByteArray was unsuccessful");

where:


loadDataFromFile( )

Format

public boolean loadDataFromFile(String filename)

Description

Loads data from the local file into the database ORDAudio object LOB locator and into the application object. It also calls setLocal( ), which sets the local field of the application ORDAudio object, but not the database object, and setUpdateTime(null), which sets the updateTime attribute to the SYSDATE of the database server.

Parameters

filename

The name of the local file from which to load data.

Return Value

This method returns TRUE if loading is successful; FALSE otherwise.

Exceptions

java.sql.SQLException

java.io.IOException

Example

audObj.loadDataFromFile("testaud.dat");

where:


loadDataFromInputStream( )

Format

public boolean loadDataFromInputStream(InputStream inpStream)

Description

Loads data from the local input stream into the database ORDAudio object LOB locator and into the application object. It also calls setLocal( ), which sets the local field of the application ORDAudio object, but not the database object, and setUpdateTime(null), which sets the updateTime attribute to the SYSDATE of the database server.

Parameters

inpStream

The name of the local input stream from which to load data.

Return Value

This method returns TRUE if loading is successful; FALSE otherwise.

Exceptions

java.sql.SQLException

java.io.IOException

Example

FileInputStream fStream = new FileInputStream("testaud.dat");
audObj.loadDataFromInputStream(fStream);

where:


openSource( )

Format

public int openSource(byte[ ] userarg, byte[ ] ctx[ ])

Description

Opens the ORDAudio file source.

Parameters

userarg

Permission-related parameters that are supplied by the user, such as READONLY. These may be used by user-defined source plug-ins.

ctx[ ]

The source plug-in context information. See Chapter 4 of Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.

Return Value

This method returns 0 if the operation is successful, or an integer greater than 0 in case of failure.

Exceptions

java.lang.Exception

Example

byte[ ] userarg = new byte[4000];
byte[ ] ctx[ ] = new byte[4000][1];
int i = audObj.openSource(userarg,ctx);
if(i == 0)
     System.out.println("openSource successful");
else
     System.out.println("openSource unsuccessful");

where:


OrdAudio( )

Format

public OrdAudio( )

Description

Creates an ORDAudio object.

This method is the default ORDAudio constructor.

Parameters

None.

Return Value

None.

Exceptions

None.

Example

None.


processAudioCommand( )

Format

public byte[ ] processAudioCommand(byte[ ] ctx[ ], String command, String args, byte[ ] result[ ])

Description

Processes the specified command on the application ORDAudio object by calling the database processAudioCommand( ) method.

Parameters

ctx[ ]

The format plug-in context information. It is set to NULL if there is no context information.

command

The command to be executed. The command must be recognized by the database format plug-in.

args

The arguments of the command.

result[ ]

The results of the command.

Return Value

This method returns the results of the execution of the command.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1]
String command;
String arguments;
byte[ ] result;
//assign a command value to command
//assign any arguments to args
byte[ ] commandResults = audObj.processAudioCommand(ctx,command,
     arguments,result);

where:


processSourceCommand( )

Format

public byte[ ] processSourceCommand(byte[ ] ctx[ ], String command, String args, byte[ ] result[ ])

Description

Processes the specified command on the application ORDAudio object by calling the database processSourceCommand( ) method.

Parameters

ctx[ ]

The source plug-in context information. See Chapter 4 of Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.

command

The command to be executed. The command must be recognized by the database source plug-in.

args

The arguments of the command to be executed.

result[ ]

The results of the command.

Return Value

This method returns the results of executing the command.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1];
String command;
String arguments;
byte[ ] result;
//assign a command value to command
//assign any arguments to args
byte[ ] commandResults = audObj.processSourceCommand(ctx,command,
     arguments,result);

where:


readFromSource( )

Format

public int readFromSource(byte[ ] ctx[ ], int startpos, int numbytes, byte[ ] buffer)

Description

Reads data from the comments field of the application ORDAudio object.

Parameters

ctx[ ]

The source plug-in context information. See Chapter 4 of Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.

startpos

The initial position in the comments field.

numbytes

The number of bytes to be read.

buffer

The buffer into which to read the content.

Return Value

This method returns the number of bytes read.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1];
byte[ ] commentBuffer = new byte[12];
int i = audObj.readFromSource(ctx,0,12,commentBuffer);

where:


setAudioDuration( )

Format

public void setAudioDuration(int audioDuration)

Description

Sets the audio duration of the application ORDAudio object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.

Parameters

audioDuration

The audio duration (in seconds) to be set in the ORDAudio object.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.setAudioDuration(16);

where:


setComments( )

Format

public void setComments(oracle.sql.CLOB comments)

Description

Sets the comments in the application ORDAudio object.

The comments attribute is reserved for use by interMedia. You can set your own value, but it could be overwritten by interMedia Annotator.

Parameters

comments

A CLOB that contains comments for the ORDAudio object.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.setComments(commentsData);

where:


setCompressionType( )

Format

public void setCompressionType(String CompressionType)

Description

Sets the compression type of the application ORDAudio object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.

Parameters

CompressionType

The compression type of the ORDAudio object, as a String.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.setCompressionType("8BITMONOAUDIO");

where:


setDescription( )

Format

public void setDescription(String description)

Description

Sets the description attribute of the application ORDAudio object.

Parameters

description

A String that describes the contents of the ORDAudio object.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.setDescription("My audio file");

where:


setEncoding( )

Format

public void setEncoding(String encoding)

Description

Sets the encoding of the application ORDAudio object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.

Parameters

encoding

The encoding of the contents of an ORDAudio object, as a String.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.setEncoding("MULAW");

where:


setFormat( )

Format

public void setFormat(String format)

Description

Sets the format attribute of the application ORDAudio object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.

Parameters

format

The format of the contents of the ORDAudio object, as a String.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.setFormat("AUFF");

where:


setKnownAttributes( )

Format

public void setKnownAttributes(String knownformat, String knownencoding,
int knownnumberofchannels, int knownsamplingrate,
int knownsamplesize, String knowncompressiontype,
int knownaudioduration)

Description

Sets the known attributes of the ORDAudio object.

setProperties( ) will automatically set these attributes; use this method only if you are not using setProperties( ). Also, this method will set only the attribute values; it does not change the media file itself.

Parameters

knownformat

The audio data format.

knownencoding

The audio data encoding.

knownnumberofchannels

The number of channels.

knownsamplingrate

The sampling rate.

knownsamplesize

The sample size.

knowncompressiontype

The compression type.

knownaudioduration

The audio duration.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.setKnownAttributes("AUFF","MULAW",1,8,8,"8BITMONOAUDIO",16);

where:


setLocal( )

Format

public void setLocal( )

Description

Sets the source local field of the application ORDAudio object.

Parameters

None.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.setLocal( );

setMimeType( )

Format

public void setMimeType(String MimeType)

Description

Sets the MIME type of the application ORDAudio object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.

Parameters

MimeType

The MIME type of the contents of the ORDAudio object, as a String.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.setMimeType("audio/basic");

where:


setNumberOfChannels( )

Format

public void setNumberOfChannels(int numberOfChannels)

Description

Sets the number of the channels in the application ORDAudio object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.

Parameters

numberOfChannels

The number of channels to be set.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.setNumberOfChannels(1);

where:


setProperties(byte[ ][ ])

Format

public void setProperties(byte[ ] ctx[ ])

Description

Reads the audio data, extracts the properties, and sets the properties in the application ORDAudio object.

The properties to be set include format, encoding, number of channels, sampling rate, sample size, compression type, and audio duration.

Parameters

ctx[ ]

The format plug-in context information. It is set to NULL if there is no context information.

Return Value

None.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1];
audObj.setProperties(ctx);

where:


setProperties(byte[ ][ ], boolean)

Format

public void setProperties(byte[ ] ctx[ ], boolean setComments)

Description

Reads the media data, extracts the properties, and sets the properties in the application ORDAudio object.

The properties to be set include format, encoding, number of channels, sampling rate, sample size, compression type, and audio duration.

Parameters

ctx[ ]

The format plug-in context information. It is set to NULL if there is no context information.

setComments

A Boolean value to determine whether or not to set the comments in the ORDAudio object. If TRUE, the comments field is populated with a set of format and application properties of the audio object in XML. If FALSE, the comments field remains unpopulated. The default value is FALSE.

Return Value

None.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1];
audObj.setProperties(ctx,true);

where:


setSampleSize( )

Format

public void setSampleSize(int sampleSize)

Description

Sets the sample size in the application ORDAudio object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.

Parameters

sampleSize

The sample size of the ORDAudio object.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.setSampleSize(8);

where:


setSamplingRate( )

Format

public void setSamplingRate(int samplingRate)

Description

Sets the sampling rate of the application ORDAudio object.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.

Parameters

samplingRate

The sampling rate value to be set, in samples per second.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.setSamplingRate(8);

where:


setSource( )

Format

public void setSource(String sourceType, String sourceLocation, String sourceName)

Description

Sets the application ORDAudio object source information.

Parameters

sourceType

The type of the source.

sourceLocation

The location of the source.

sourceName

The name of the source.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.setSource("FILE","AUDIODIR","audio.au");

where:


setUpdateTime( )

Format

public void setUpdateTime(java.sql.Timestamp currentTime)

Description

Sets the update time in the application ORDAudio object to the current time.

setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.

Parameters

currentTime

The current time, which will be set in the ORDAudio object. This value should be NULL; the method will then use the SYSDATE of the database server.

Return Value

None.

Exceptions

java.sql.SQLException

Example

audObj.setUpdateTime(null);

trimSource( )

Format

public int trimSource(byte[ ] ctx[ ], int newLen)

Description

Trim the file source of the application ORDAudio object to the given length.

Parameters

ctx[ ]

The source plug-in context information. See Chapter 4 of Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.

newLen

The length to which the source will be trimmed.

Return Value

This method returns 0 if the operation is successful, or an integer greater than 0 in case of failure.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1];
int i = audObj.trimSource(ctx,10);
if (i == 0)
     System.out.println("trimSource successful");
else
     System.out.println("trimSource unsuccessful");

where:


writeToSource( )

Format

public int writeToSource(byte[ ] ctx[ ], int startpos, int numbytes, byte[ ] buffer)

Description

Writes data to the comments field of the application ORDAudio object.

Parameters

ctx[ ]

The source plug-in context information. See Chapter 4 of Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.

startpos

The initial position in the comments field.

numbytes

The number of bytes to be written.

buffer

The buffer containing the content to be written.

Return Value

This method returns the number of bytes written.

Exceptions

java.sql.SQLException

Example

byte[ ] ctx[ ] = new byte[4000][1];
byte[ ] data = new byte[20];
//populate data with 20 bytes of content
int i = audObj.writeToSource(ctx,1,20,data);

where:


Go to previous page Go to next page
Oracle
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index