Oracle8i interMedia Audio, Image, and Video Java Client User's Guide and Reference
Release 8.1.5

A67296-01

Library

Product

Contents

Index

Prev Next

5
ORDAudio Reference Information

Oracle8i interMedia Audio, Image, and Video Java Client contains information about the ORDAudio:

Methods invoked at the ORDAudio level that are handed off for processing to the server-side source plug-in or server-side format plug-in have byte[ ] ctx as a context parameter. 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.  


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

5.1 Object Types

Oracle8i interMedia Audio, Image, and Video Java Client describes the ORDAudio object type, which supports the storage and management of audio data.


ORDAudio Object Type

The ORDAudio object type supports the storage and management of audio data.


Note:

In the following code, some methods will begin with public. This indicates that the method can be called by all classes in all packages. The methods that are not designated as public have the default protection, which means that they can be called only by other methods in the package.  


This object type is defined as follows:

package oracle.ord.media;
import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.*;
import oracle.sql.*;

     public class ORDAudio extends ORDMultiMedia {
     
     String encoding;
     int numberOfChannels;
     int samplingRate;
     int sampleSize;
     String compressionType;
     int audioDuration;
     String description;
     CLOB comments;
     
     public ORDAudio( )
     { } 
     
     public ORDAudio(Connection the_connection)
     { } 
     
     String getMediaType( )
     { }
     
     String getFormatStr( )
     { }
     
     String getUpdStr( )
     { }
     
     String getSourceStr( )
     { }
     
     String getContentLengthAPI( )
     { }
     
     public int getContentLength( )
     throws SQLException
     { }
     
     String getSQLConstructor(boolean updateOption, String objName)
     { }
     
     String defineSQLResults(String var)
     { }
     
     int declareSQLResults(int start, OracleCallableStatement stmt)
     throws SQLException
     { }
     
     String setSQLParams(String var)
     { }
     
     int bindInSQLParams(int start, OracleCallableStatement stmt)
     throws SQLException
     { }
     
     int getSQLResults(int start, OracleCallableStatement stmt)
     throws SQLException
     { }
     
     public void refresh(boolean forUpdate)
     throws SQLException
     { }
     
     public void flush( )
     throws SQLException
     { }
     
     public void setEncoding(String the_encoding)
     { }
     
     public void setNumberOfChannels(int the_numberOfChannels)
     { }
     
     public void setSamplingRate(int the_samplingRate)
     { }
     
     public void setSampleSize(int the_sampleSize)
     { }
     
     public void setCompressionType(String the_compressionType)
     { }
     
     public void setKnownAttributes(String knownFormat,
          String knownEncoding, int knownNumberOfChannels,
          int knownSampleSize, int knownSamplingRate,
          String knownCompressionType, int knownAudioDuration)
     { }
     
     public void setAudioDuration(int the_audioDuration)
     { }
     
     public String getFormat(byte[ ] ctx)
     throws SQLException
     { }
     
     public String getEncoding(byte[ ] ctx)
     throws SQLException
     { }
     
     public String getEncoding( )
     { }
     
     public int getNumberOfChannels(byte[ ] ctx)
     throws SQLException
     { }
     
     public int getNumberOfChannels( )
     { }
     
     public int getSamplingRate(byte[ ] ctx)
     throws SQLException
     { }
     
     public int getSamplingRate( )
     { }
     
     public int getSampleSize(byte[ ] ctx)
     throws SQLException
     { }
     
     public int getSampleSize( )
     { }
     
     public String getCompressionType(byte[ ] ctx)
     throws SQLException
     { }
     
     public String getCompressionType( )
     { }
     
     public int getAudioDuration(byte[ ] ctx)
     throws SQLException
     { }
     
     public int getAudioDuration( )
     { }
     
     public void setDescription(String the_description)
     { }
     
     public String getDescription( )
     { }
     
     public int getContentLength(byte[ ] ctx)
     throws SQLException
     { }
     
     public void setProperties(byte[ ] ctx)
     throws SQLException
     { }
     
     public boolean checkProperties(byte[ ] ctx)
     throws SQLException
     { }
     
     public void appendToComments(int amount, String buffer)
     throws SQLException
     { }
     
     public void writeToComments(int offset, int amount, String buffer)
     throws SQLException
     { }
     
     String readFromComments(int offset, int amount)
     throws SQLException
     { }
     
     public int locateInComment(String pattern, int offset, int occurrence)
     throws SQLException
     { }
     
     public void trimComments(int newlen)
     throws SQLException
     { }
     
     public int eraseFromComments(int amount, int offset)
     throws SQLException
     { }
     
     public void deleteComments( )
     throws SQLException
     { }
     
     public CLOB copyCommentsOut(CLOB dest, int amount, int from_loc,
          int to_loc)
     throws SQLException
     { }
     
     public int compareComments(CLOB dest, int amount,
          int start_in_comment, int start_in_compare_comment)
     throws SQLException
     { }
     
     public void loadCommentsFromFile(String loc, String fileName,
          int amount, int from_loc, int to_loc)
     throws SQLException
     { }
     
     public int getCommentLength( )
     throws SQLException
     { }
     
     public String getAttribute(byte[ ] ctx, String name)
     throws SQLException
     { }
     
     public CLOB getAllAttributes(byte[ ] ctx)
     throws SQLException
     { }
     
     public String getAllAttributesAsString(byte[ ] ctx)
     throws SQLException
     { }
     
     public BLOB getContentInLob(byte[ ] ctx, StringBuffer mimeType,
          StringBuffer format)
     throws SQLException
     { }
     
     public int openSource(byte[ ] userArg, byte[ ] ctx)
     throws SQLException
     { }
     
     public int closeSource(byte[ ] ctx)
     throws SQLException
     { }
     
     public int trimSource(byte[ ] ctx, int newLen)
     throws SQLException
     { }
     
     public int readFromSource(byte[ ] ctx, int startPos, int numBytes,
          byte[ ] buffer)
     throws SQLException
     { }
     
     public int writeToSource(byte[ ] ctx, int startPos, int numBytes,
          byte[ ] buffer)
     throws SQLException
     { }
     
     public byte[ ] processSourceCommand(byte[ ] ctx, String cmd,
          String args, byte[ ] result)
     throws SQLException
     { }
     
     public byte[ ] processAudioCommand(byte[ ] ctx, String cmd, String args,
          byte[ ] result)
     throws SQLException
     { }
     
     public CLOB getComments( )
     throws SQLException
     { }
     
     public void setComments(CLOB the_comments)
     throws SQLException
     { }
     
     public String getCommentsAsString( )
     throws SQLException, OutOfMemoryError
     { }
     
     public boolean loadComments(String filename)
     throws SQLException, IOException, SecurityException
     { }
     
     boolean loadCommentsInChunks(String fileName, int fileLength)
     throws SQLException, IOException
     { }
}

where the class attributes are defined as:

5.2 Methods

This section presents ORDAudio reference information on the methods used for audio data manipulation. These methods are described in the following groupings:

ORDAudio Methods Associated with Audio Attribute Accessors

ORDAudio Methods Associated with the description Attribute

ORDAudio Methods Associated with the comments Attribute

ORDAudio Methods Associated with the Media Type

ORDAudio Methods Associated with the Content Length

ORDAudio Methods Associated with Communication Between the Client and Server

ORDAudio Methods Associated with the SQL Type

ORDAudio Methods Associated with Generating SQL Queries

ORDAudio Methods Associated with File Operations

ORDAudio Methods Associated with Source Content Operations

ORDAudio Methods Associated with Processing Audio Data

5.2.1 ORDAudio Methods Associated with the Audio Attribute Accessors

This section presents reference information on the ORDAudio methods associated with audio attribute accessors.

The methods described in this reference chapter show examples based on the instantiation of an ORDAudio object. For the examples in Section 5.2.1 through Section 5.2.11, please consult the following code:

public class clientProgram{
     public static void main(String[ ] args){
          The code in the examples appears here
     }
}

In each example, the parameter connection is a connection to the Oracle database.


setEncoding( ) Method

Format

public void setEncoding(String the_encoding)

Scope

public

Description

Sets the encoding in the client-side ORDAudio object.

Parameter

the_encoding

The encoding value to be set.

Returns

None.

Exceptions

None.

Usage

OrdAudio audioObj = new OrdAudio(connection);
.
.
.
audioObj.setEncoding("MULAW");

where:


getEncoding(byte[ ]) Method

Format

public String getEncoding(byte[ ] ctx)
throws SQLException

Scope

public

Description

Gets the encoding from the server-side ORDAudio object by calling the server-side method getEncoding(ctx RAW), which extracts the information from the BLOB data.

Parameter

ctx

The format plug-in context information.

Returns

This method returns the encoding.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     String audStr = audioObj.getEncoding(ctx);
}
catch(SQLException e){
     .
     .
     .
}

where:


getEncoding( ) Method

Format

public String getEncoding( )

Scope

public

Description

Gets the encoding from the client-side ORDAudio object from the client cache.

Parameter

None.

Returns

This method returns the encoding value present in the client object cache.

Exceptions

None.

Usage

OrdAudio audioObj = new OrdAudio(connection);
.
.
.
String audStr = audioObj.getEncoding( );

setNumberOfChannels( ) Method

Format

public void setNumberOfChannels(int the_numberOfChannels)

Scope

public

Description

Sets the number of channels in the client-side ORDAudio object.

Parameter

the_numberOfChannels

The number of channels value to be set.

Returns

None.

Exceptions

None.

Usage

OrdAudio audioObj = new OrdAudio(connection);
.
.
.
audioObj.setNumberOfChannels(1);

where:


getNumberOfChannels(byte[ ]) Method

Format

public int getNumberOfChannels(byte[ ] ctx)
throws SQLException

Scope

public

Description

Gets the number of channels in the server-side ORDAudio object by calling the server-side method getNumberOfChannels(ctx RAW), which extracts the number of channels from the BLOB data.

Parameter

ctx

The format plug-in context information.

Returns

This method returns the number of channels.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     int i = audioObj.getNumberOfChannels(ctx);
}
catch(SQLException e){
     .
     .
     .
}

where:


getNumberOfChannels( ) Method

Format

public int getNumberOfChannels( )

Scope

public

Description

Returns the number of channels in the client-side ORDAudio object from the client cache.

Parameter

None.

Returns

This method returns the number of channels present in the client object cache.

Exceptions

None.

Usage

OrdAudio audioObj = new OrdAudio(connection);
.
.
.
int i = audioObj.getNumberOfChannels( );

setSamplingRate( ) Method

Format

public void setSamplingRate(int the_samplingRate)

Scope

public

Description

Sets the sampling rate in the client-side ORDAudio object.

Parameter

the_samplingRate

The sampling rate to be set.

Returns

None.

Exceptions

None.

Usage

OrdAudio audioObj = new OrdAudio(connection);
.
.
.
audioObj.setSamplingRate(10);

where:


getSamplingRate(byte[ ]) Method

Format

public int getSamplingRate(byte[ ] ctx)
throws SQLException

Scope

public

Description

Gets the sampling rate of the server-side ORDAudio object. The method gets the sampling rate by calling the server-side method getSamplingRate(ctx RAW), which extracts the sampling rate from the BLOB data.

Parameter

ctx

The format plug-in context information.

Returns

This method returns the sampling rate.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     int i = audioObj.getSamplingRate(ctx);
}
catch(SQLException e){
     .
     .
     .
}

where:


getSamplingRate( ) Method

Format

public int getSamplingRate( )

Scope

public

Description

Gets the sampling rate of the client-side ORDAudio object from the client cache.

Parameter

None.

Returns

This method returns the sampling rate value in the client object cache.

Exceptions

None.

Usage

OrdAudio audioObj = new OrdAudio(connection);
.
.
.
int i = audioObj.getSamplingRate( );

setSampleSize( ) Method

Format

public void setSampleSize(int the_sampleSize)

Scope

public

Description

Sets the sample size of the client-side ORDAudio object.

Parameter

the_sampleSize

The sample size to be set.

Returns

None.

Exceptions

None.

Usage

OrdAudio audioObj = new OrdAudio(connection);
.
.
.
audioObj.setSampleSize(100);

where:


getSampleSize(byte[ ]) Method

Format

public int getSampleSize(byte[ ] ctx)
throws SQLException

Scope

public

Description

Gets the sample size of the server-side ORDAudio object. The method gets the sample size by calling the server-side method getSampleSize(ctx RAW), which extracts the sample size from the BLOB data.

Parameter

ctx

The format plug-in context information.

Returns

This method returns the sample size.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     int i = audioObj.getSampleSize(ctx);
}
catch(SQLException e){
     .
     .
     .
}

where:


getSampleSize( ) Method

Format

public int getSampleSize( )

Scope

public

Description

Gets the sample size of the client-side ORDAudio object from the client cache.

Parameter

None.

Returns

This method returns the sample size value from the client object cache.

Exceptions

None.

Usage

OrdAudio audioObj = new OrdAudio(connection);
.
.
.
int i = audioObj.getSampleSize( );

setCompressionType( ) Method

Format

public void setCompressionType(String the_compressionType)

Scope

public

Description

Sets the compression type of the client-side ORDAudio object.

Parameter

the_compressionType

The compression type to be set.

Returns

None.

Exceptions

None.

Usage

OrdAudio audioObj = new OrdAudio(connection);
.
.
.
audioObj.setCompressionType("8BITMONOAUDIO");

where:


getCompressionType(byte[ ]) Method

Format

public String getCompressionType(byte[ ] ctx)
throws SQLException

Scope

public

Description

Gets the compression type of the server-side ORDAudio object. The method gets the compression type by calling the server-side method getCompressionType(ctx RAW), which extracts the compression type from the BLOB data.

Parameter

ctx

The format plug-in context information.

Returns

This method returns the compression type.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     String audStr = audioObj.getCompressionType(ctx);
}
catch(SQLException e){
     .
     .
     .
}

where:


getCompressionType( ) Method

Format

public String getCompressionType( )

Scope

public

Description

Gets the compression type of the client-side ORDAudio object from the client cache.

Parameter

None.

Returns

This method returns the compression type stored in the client object cache.

Exceptions

None.

Usage

OrdAudio audioObj = new OrdAudio(connection);
.
.
.
String audStr = audioObj.getCompressionType( );

setAudioDuration( ) Method

Format

public void setAudioDuration(int the_audioDuration)

Scope

public

Description

Sets the audio duration in the client-side ORDAudio object.

Parameter

the_audioDuration

The audio duration to be set.

Returns

None.

Exceptions

None.

Usage

OrdAudio audioObj = new OrdAudio(connection);
.
.
.
audioObj.setAudioDuration(100);

where:


getAudioDuration(byte[ ]) Method

Format

public int getAudioDuration(byte[ ] ctx)
throws SQLException

Scope

public

Description

Gets the audio duration of the server-side ORDAudio object. The method gets the audio duration by calling the server-side method getAudioDuration(ctx RAW), which extracts the audio duration from the BLOB data.

Parameter

ctx

The format plug-in context information.

Returns

This method returns the audio duration.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     int i = audioObj.getAudioDuration(ctx);
}
catch(SQLException e){
     .
     .
     .
}

where:


getAudioDuration( ) Method

Format

public int getAudioDuration( )

Scope

public

Description

Gets the audio duration of the client-side ORDAudio object from the client cache.

Parameter

None.

Returns

This method returns the audio duration value stored in the client object cache.

Exceptions

None.

Usage

OrdAudio audioObj = new OrdAudio(connection);
.
.
.
int i = audioObj.getAudioDuration( );

getFormat( ) Method

Format

public String getFormat(byte[ ] ctx)
throws SQLException

Scope

public

Description

Gets the format in the server-side ORDAudio object.

Parameter

ctx

The format plug-in context information.

Returns

This method returns the format.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     String audStr = audioObj.getFormat(ctx);
}
catch(SQLException e){
     .
     .
     .
}

where:


setProperties( ) Method

Format

public void setProperties(byte[ ] ctx)
throws SQLException

Scope

public

Description

Sets the properties of the specified audio data in both the client-side and server-side ORDAudio objects.

The audio attributes to be set include the following: format, encoding type, number of channels, sampling rate, and sample size.

Parameter

ctx

The format plug-in context information.

Returns

None.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     audioObj.setProperties(ctx);
}
catch(SQLException e){
     .
     .
     .
}

where:


checkProperties( ) Method

Format

public boolean checkProperties(byte[ ] ctx)
throws SQLException

Scope

public

Description

Checks whether or not the properties stored in the server-side ORDAudio object are consistent with those in the server-side raw media data.

Parameter

ctx

The format plug-in context information.

Returns

This method returns true if the object cache values of the attributes match those derived from the BLOB data content; false otherwise.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     if(audioObj.checkProperties(ctx)){
          system.out.println("Values matched.");
     }
}
catch(SQLException e){
     .
     .
     .
}

where:


setKnownAttributes( ) Method

Format

public void setKnownAttributes(String knownFormat, String knownEncoding,
                              int knownNumberOfChannels,
                              int knownSampleSize, int knownSamplingRate,
                              String knownCompressionType,
                              int knownAudioDuration)

Scope

public

Description

Sets the known attributes of the client-side ORDAudio object on the client side.

Parameters

knownFormat

The audio data format.

knownEncoding

The audio data encoding.

knownNumberOfChannels

The number of channels.

knownSampleSize

The sample size.

knownSamplingRate

The sampling rate.

knownCompressionType

The compression type.

knownAudioDuration

The audio duration.

Returns

None.

Exceptions

None.

Usage

OrdAudio audioObj = new OrdAudio( );
audioObj.setKnownAttributes("AUFF", "MULAW", 1, 100, 10, "8BITMONOAUDIO", 100);

where:


getAttribute( ) Method

Format

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

Scope

public

Description

Gets the attribute value of the server-side ORDAudio object.

Parameters

ctx

The format plug-in context information.

name

The name of the attribute.

Returns

This method returns the attribute value.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     String audStr = audioObj.getAttribute(ctx, "encoding");
}
catch(SQLException e){
     .
     .
     .
}

where:


getAllAttributes( ) Method

Format

public CLOB getAllAttributes(byte[ ] ctx)
throws SQLException

Scope

public

Description

Gets all the attributes values of the server-side ORDAudio object and returns them as a CLOB.

Parameter

ctx

The format plug-in context information.

Returns

This method returns all of the attribute values, as a CLOB.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     CLOB clob = audioObj.getAllAttributes(ctx);
}
catch(SQLException e){
     .
     .
     .
}

where:


getAllAttributesAsString( ) Method

Format

public String getAllAttributesAsString(byte[ ] ctx)
throws SQLException

Scope

public

Description

Gets all the attributes values of the server-side ORDAudio object as a String.

Parameter

ctx

The format plug-in context information.

Returns

This method returns all the attribute values, as a String. It will be formatted similarly to the following String:

sample_size=8, sampling_rate=8, num_channels=1, file_format=AUFF, data_type=8BITMONOAUDIO, encoding=MULAW

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     String audStr = audioObj.getAllAttributesAsString(ctx);
}
catch(SQLException e){
     .
     .
     .
}

where:

5.2.2 ORDAudio Methods Associated with the description Attribute

This section presents reference information on the ORDAudio methods associated with the description attribute.

See Section 5.2.1 for additional code required to run the example code.


setDescription( ) Method

Format

public void setDescription(String the_description)

Scope

public

Description

Sets the description attribute of the client-side ORDAudio object.

Parameter

the_description

The description.

Returns

None.

Exceptions

None.

Usage

OrdAudio audioObj = new OrdAudio(connection);
.
.
.
audioObj.setDescription("audio1.wav");

where:


getDescription( ) Method

Format

public String getDescription( )

Scope

public

Description

Gets the description attribute with extension of the client-side ORDAudio object.

If a lock has been acquired on the row containing the object, this method gets the title attribute locally. Otherwise, this method gets the value from the server side by refreshing the client-side object.

Parameter

None.

Returns

This method returns the description.

Exceptions

None.

Usage

OrdAudio audioObj = new OrdAudio(connection);
.
.
.
String audStr = audioObj.getDescription( );

5.2.3 ORDAudio Methods Associated with the comments Attribute

This section presents reference information on the ORDAudio methods associated with the comments attribute.

See Section 5.2.1 for additional code required to run the example code.


setComments( ) Method

Format

public void setComments(CLOB the_comments)
throws SQLException

Scope

public

Description

Sets the comments attribute on the server side and in the client cache with a CLOB.

Parameter

the_comments

The comments data.

Returns

None.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     audioObj.setComments(commentsFile);
}
catch(SQLException e){
     .
     .
     .
}

where:


getComments( ) Method

Format

public CLOB getComments( )
throws SQLException

Scope

public

Description

Copies the CLOB from the server side to the client side and returns the LOB locator from the client cache.

Parameter

None.

Returns

This method returns the comments attribute from the client cache.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     CLOB clob = audioObj.getComments( );
}
catch(SQLException e){
     .
     .
     .
}

getCommentsAsString( ) Method

Format

public String getCommentsAsString( )
throws SQLException, OutOfMemoryError

Scope

public

Description

Returns the comments from the server-side ORDAudio object as a String.

Parameter

None.

Returns

This method returns the comments attribute as a String.

Exceptions

java.sql.SQLException

java.lang.OutOfMemoryError

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     String comments = audioObj.getCommentsAsString( );
}
catch(SQLException e){
     .
     .
     .
}

appendToComments( ) Method

Format

public void appendToComments(int amount, String buffer)
throws SQLException

Scope

public

Description

Appends data to the server-side ORDAudio object comments attribute.

Parameters

amount

The amount of data to be appended, in bytes.

buffer

The content to be written from the buffer.

Returns

None.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     audioObj.appendToComments(5, "Drama");
}
catch(SQLException e){
     .
     .
     .
}

where:


writeToComments( ) Method

Format

public void writeToComments(int offset, int amount, String buffer)
throws SQLException

Scope

public

Description

Writes data to the server-side ORDAudio object comments attribute.

Parameters

offset

The offset from the beginning from which this method will start writing.

amount

The amount of data to be written, in bytes.

buffer

The content to be written from the buffer.

Returns

None.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     audioObj.writeToComments(0, 5, "Drama");
}
catch(SQLException e){
     .
     .
     .
}

where:


readFromComments( ) Method

Format

public String readFromComments(int offset, int amount)
throws SQLException

Scope

public

Description

Reads data from the server-side ORDAudio object comments attribute.

Parameters

offset

The offset from the beginning from which this method will start reading.

amount

The amount of data to be read, in bytes.

Returns

This method returns the String that is read.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     String audStr = audioObj.readFromComments(0, 5);
}
catch(SQLException e){
     .
     .
     .
}

where:


locateInComment( ) Method

Format

public int locateInComment(String pattern, int offset, int occurrence)
throws SQLException

Scope

public

Description

Locates a pattern in the server-side ORDAudio object that appears a certain number of times starting from a certain offset in the comments attribute.

Parameters

pattern

The pattern to be matched.

offset

The offset from the beginning from which this method will start searching.

occurrence

The number of times that the pattern should appear in the comments.

Returns

This method returns true if the pattern occurs in the comments attribute for the specified number of times after the offset.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     int i = audioObj.locateInComment("Drama", 0, 10);
}
catch(SQLException e){
     .
     .
     .
}

where:


trimComments( ) Method

Format

public void trimComments(int newlen)
throws SQLException

Scope

public

Description

Trims the server-side ORDAudio object comments to a given length.

Parameter

newlen

The new length of the comments attribute after trimming.

Returns

None.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     audioObj.trimComments(100);
}
catch(SQLException e){
     .
     .
     .
}

where:


eraseFromComments( ) Method

Format

public int eraseFromComments(int amount, int offset)
throws SQLException

Scope

public

Description

Erases data from the server-side ORDAudio object comments starting from a certain offset and continuing to a certain length.

Parameters

amount

The amount to be erased, in bytes.

offset

The offset from the beginning from which this method will start erasing.

Returns

This method returns the amount of data erased, in bytes.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     audioObj.eraseFromComments(100, 0);
}
catch(SQLException e){
     .
     .
     .
}

where:


deleteComments( ) Method

Format

public void deleteComments( )
throws SQLException

Scope

public

Description

Deletes the server-side ORDAudio object comments.

Parameter

None.

Returns

None.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     audioObj.deleteComments( );
}
catch(SQLException e){
     .
     .
     .
}

copyCommentsOut( ) Method

Format

public CLOB copyCommentsOut(CLOB dest, int amount, in from_loc,
                            int to_loc)
throws SQLException

Scope

public

Description

Copies comments out from the a server-side location to a new location.

Parameters

dest

The CLOB into which the comments will be copied.

amount

The amount of data to be copied, in bytes.

from_loc

The position where the copying will begin.

to_loc

The position where the copying will end.

Returns

This method returns the CLOB into which the comments are copied.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     CLOB clob = audioObj.copyCommentsOut(my_CLOB, 100, 0, 99);
}
catch(SQLException e){
     .
     .
     .
}

where:


compareComments( ) Method

Format

public int compareComments(CLOB dest, int amount,
                           int start_in_comment,
                           int start_in_compare_comment)
throws SQLException

Scope

public

Description

Compares the comments of the server-side ORDAudio object with a separate CLOB.

Parameters

dest

The location of the comments data that will be compared with the comments data of this object.

amount

The amount of data to be compared, in bytes.

start_in_comment

The starting position in the current object.

start_in_compare_comment

The starting position in the separate object.

Returns

This method returns 1 if the comments match; -1 if the comments do not match.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     OrdAudio audioObj2 = new OrdAudio(connection);
     .
     .
     .
     int i = audioObj.compareComments(audioObj2.comments, 100, 0, 50);
}
catch(SQLException e){
     .
     .
     .
}

where:


loadCommentsFromFile( ) Method

Format

public void loadCommentsFromFile(String loc, String fileName,
                                 int amount, int from_loc, int to_loc)
throws SQLException

Scope

public

Description

Loads a given amount of comments data to the server-side ORDAudio object from a separate server-side file.

Parameters

loc

The location of the file from which the comments will be loaded.

fileName

The name of the file from which the comments will be loaded.

amount

The amount of data to be loaded, in bytes.

from_loc

The start location in the comments attribute into which the comments will be loaded.

to_loc

The end location in the comments attribute into which the comments will be loaded.

Returns

None.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     BFILE my_bfile;
     .
     .
     .
     audioObj.loadCommentsFromFile("commentsdir", "my_bfile", 100, 0, 99);
}
catch(SQLException e){
     .
     .
     .
}

where:


loadComments( ) Method

Format

public boolean loadComments(String fileName)
throws SQLException, IOException, SecurityException

Scope

public

Description

Loads comments data to the server-side ORDAudio object from a separate client-side file.

Parameter

fileName

The name of the file from which the comments will be loaded.

Returns

This method returns true upon successful loading; false otherwise.

Exceptions

java.sql.SQLException

java.io.IOException

java.lang.SecurityException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     audioObj.loadCommentsFromFile(my_file);
}
catch(SQLException e){
     .
     .
     .
}
catch(IOException io){
     .
     .
     .
}
catch(SecurityException s){
     .
     .
     .
}

where:


loadCommentsInChunks( ) Method

Format

boolean loadCommentsInChunks(String fileName, int fileLength)
throws SQLException, IOException

Scope

package

Description

Loads comments to the server-side ORDAudio object from a separate client-side file in chunks of 32K at a time.

Parameters

fileName

The name of the file from which the comments will be loaded.

fileLength

The total length of the file, in bytes.

Returns

This method returns true upon successful loading; false otherwise.

Exceptions

java.sql.SQLException

java.io.IOException

Usage

Do not use this method unless you are extending the package.


getCommentLength( ) Method

Format

public int getCommentLength( )
throws SQLException

Scope

public

Description

Gets the length of the server-side ORDAudio object comments attribute.

Parameter

None.

Returns

This method returns the length of the comments attribute.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     int i = audioObj.getCommentLength( );
}
catch(SQLException e){
     .
     .
     .
}

5.2.4 ORDAudio Methods Associated with the Media Type

This section presents reference information on the ORDAudio methods associated with the media type.

See Section 5.2.1 for additional code required to run the example code.


getMediaType( ) Method

Format

String getMediaType( )

Scope

public

Description

Returns the media type information.

Parameter

None.

Returns

This method returns the media type, which is OrdAudio.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.

5.2.5 ORDAudio Methods Associated with the Content Length

This section presents reference information on the ORDAudio methods associated with the content length.

See Section 5.2.1 for additional code required to run the example code.


getContentLength(byte[ ]) Method

Format

public int getContentLength(byte[ ] ctx)
throws SQLException

Scope

public

Description

Returns the content length of the media data in the server-side ORDAudio object.

Parameter

ctx

The source plug-in context information.

Returns

This method returns the length of the data content of the media data, in bytes.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     int i = audioObj.getContentLength(ctx);
}
catch(SQLException e){
     .
     .
     .
}

where


getContentLength( ) Method

Format

public int getContentLength( )
throws SQLException

Scope

public

Description

Returns the content length of the media data in the server-side ORDAudio object.

Parameter

None.

Returns

This method returns the content length, in bytes.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     int i = audioObj.getContentLength( );
}
catch{
     .
     .
     .
}

5.2.6 ORDAudio Methods Associated with Communication Between the Client and Server

This section presents reference information on the ORDAudio methods associated with communication between the client and server.

See Section 5.2.1 for additional code required to run the example code.


refresh( ) Method

Format

public void refresh(boolean forUpdate)
throws SQLException

Scope

public

Description

Copies the server-side ORDAudio object attribute values to the client-side ORDAudio object with or without locking the database row.

Parameter

forUpdate

The indicator for whether or not the option has been refreshed for update. It is true if the object is refreshed for update; otherwise, it is false.

Returns

None.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     audioObj.refresh(false);
}
catch(SQLException e){
     .
     .
     .
}

where


flush( ) Method

Format

public void flush( )
throws SQLException

Scope

public

Description

Sends information from the client-side ORDAudio object to the server-side ORDAudio object.

Parameter

None.

Returns

None.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     audioObj.flush( );
}
catch(SQLException e){
     .
     .
     .
}

5.2.7 ORDAudio Methods Associated with the SQL Type

This section presents reference information on the ORDAudio methods associated with the SQL type.

See Section 5.2.1 for additional code required to run the example code.


getSQLConstructor( ) Method

Format

String getSQLConstructor(boolean updateOption, String objName)

Scope

package

Description

Gets the SQL type constructor for the ORDAudio object.

It calls the corresponding method in the ORDMultiMedia superclass.

Parameters

updateOption

The indicator for whether or not the option will be updated.

objName

The variable name of the audio object.

Returns

This method returns the SQL string that will bind an object instance variable to a database object instance.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.


defineSQLResults( ) Method

Format

String defineSQLResults(String var)

Scope

package

Description

Defines the SQL results that will be used to assign the values of the ORDAudio object attributes.

This method is used by the refresh( ) method to assign the server-side object attribute values to the corresponding client-side object attributes.

Parameter

var

The name of the audio object variable.

Returns

This method returns the SQL string that defines the SQL results.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.


declareSQLResults( ) Method

Format

int declareSQLResults(int start, OracleCallableStatement stmt)
throws SQLException

Scope

package

Description

Declares types for the SQL results corresponding to the different ORDAudio object attributes.

This method is used by the refresh( ) method to declare the types of the client-side object attributes needed in order to assign values to the attributes corresponding to the server-side object attributes.

Parameters

start

The position in the statement where the binding begins.

stmt

The Oracle callable statement that will be executed on the server side.

Returns

This method returns an integer defined as position + 1, where position is the last index in the statement for which the type was declared.

Exceptions

java.sql.SQLException

Usage

Do not use this method unless you are extending the package.


setSQLParams( ) Method

Format

String setSQLParams(String var)

Scope

package

Description

Sets the values of the SQL type of the ORDAudio object as parameters.

This method is used by the flush( ) method to set the values of the different attributes of the server-side object with the client-side attributes.

Parameter

var

The name of the audio object variable.

Returns

This method returns the SQL string that sets the different attributes of the audio object.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.


bindInSQLParams( ) Method

Format

int bindInSQLParams(int start, OracleCallableStatement stmt)
throws SQLException

Scope

package

Description

Binds the values of the SQL type of the ORDAudio object.

This method is used by the flush( ) method to set the values of the different attributes of the server-side object with the client-side attributes.

Parameters

start

The position in the statement where the binding begins.

stmt

The Oracle callable statement that will be executed on the server side.

Returns

This method returns an integer defined as position + 1, where position is the index of the last position in the statement to which a value was bound.

Exceptions

java.sql.SQLException

Usage

Do not use this method unless you are extending the package.


getSQLResults( ) Method

Format

int getSQLResults(int start, OracleCallableStatement stmt)
throws SQLException

Scope

package

Description

Gets the SQL results to assign to the attributes of the ORDMultiMedia object (for example, encoding or numberOfChannels).

This method is used by the refresh( ) method to assign the server-side object attribute values to the corresponding client-side object attributes.

Parameters

start

The starting position for getting results from the statement.

stmt

The Oracle callable statement that has been executed on the server side.

Returns

This method returns the SQL string that contains the PL/SQL DECLARE... BEGIN... END statement block.

Exceptions

java.sql.SQLException

Usage

Do not use this method unless you are extending the package.

5.2.8 ORDAudio Methods Associated with Generating SQL Queries

This section presents reference information on the ORDAudio methods associated with generating SQL queries.

See Section 5.2.1 for additional code required to run the example code.


getFormatStr( ) Method

Format

String getFormatStr( )

Scope

package

Description

Returns the format String, which is used by other methods to generate SQL queries.

Parameters

None.

Returns

This method returns the format String.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.


getUpdStr( ) Method

Format

String getUpdStr( )

Scope

package

Description

Returns the SQL string that is used to update an ORDAudio instance, which is used by other methods to generate SQL queries.

Parameters

None.

Returns

This method returns the SQL string that is used to update an ORDAudio instance.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.


getSourceStr( ) Method

Format

String getSourceStr( )

Scope

package

Description

Returns the source String, which is used by other methods to generate SQL queries.

Parameters

None.

Returns

This method returns the source String.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.


getContentLengthAPI( ) Method

Format

String getContentLengthAPI( )

Scope

package

Description

Returns the server-side contentLength API for this class, which is used by other methods to generate SQL queries.

Parameters

None.

Returns

This method returns the server-side contentLength API for this class.

Exceptions

None.

Usage

Do not use this method unless you are extending the package.

5.2.9 ORDAudio Methods Associated with File Operations

This section presents reference information on the ORDAudio methods associated with file operations.

See Section 5.2.1 for additional code required to run the example code.


openSource( ) Method

Format

public int openSource(byte[ ] userArg, byte[ ] ctx)
throws SQLException

Scope

public

Description

Opens the file source of the server-side ORDAudio object.

Parameters

userArg

Permission-related parameters that are supplied by the user, such as READONLY.

ctx

The source plug-in context information.

Returns

This method returns 0 in case of success or an integer greater than 0 in case of failure.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     .
     .
     .
     int i = audioObj.openSource(READONLY, ctx);
}
catch(SQLException e){
     .
     .
     .
}

where:


closeSource( ) Method

Format

public int closeSource(byte[ ] ctx)
throws SQLException

Scope

public

Description

Closes the file source of the server-side ORDAudio object.

Parameter

ctx

The source plug-in context information.

Returns

This method returns 0 in case of success or an integer greater than 0 in case of failure.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     int i = audioObj.closeSource(ctx);
}
catch(SQLException e){
     .
     .
     .
}

where:


trimSource( ) Method

Format

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

Scope

public

Description

Trims the file source of the server-side ORDAudio object to the given length.

Parameters

ctx

The source plug-in context information.

newLen

The length, in bytes, to which the file source will be trimmed.

Returns

This method returns 0 in case of success or an integer greater than 0 in case of failure.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     int i = audioObj.trimSource(ctx, 100);
}
catch(SQLException e){
     .
     .
     .
}

where:


readFromSource( ) Method

Format

public int readFromSource(byte[ ] ctx, int startPos, int numBytes,
                           byte[ ] buffer)
throws SQLException

Scope

public

Description

Reads a buffer of a given number of bytes from the server-side ORDAudio object source, beginning at a given initial position.

Parameters

ctx

The source plug-in context information.

startPos

The position where the method begins reading.

numBytes

The amount that will be read, in bytes.

buffer

The buffer into which the data will be read.

Returns

This method returns the amount of data read, in bytes.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     byte[ ] my_buffer;
     audioObj.readFromSource(ctx, 0, 100, my_buffer);
}
catch(SQLException e){
     .
     .
     .
}

where:


writeToSource( ) Method

Format

public int writeToSource(byte[ ] ctx, int startPos, int numBytes,
                          byte[ ] buffer)
throws SQLException

Scope

public

Description

Writes a buffer of a given number of bytes to the server-side ORDAudio object source, beginning at a given initial position.

Parameters

ctx

The source plug-in context information.

startPos

The initial position for writing the new data in the source.

numBytes

The number of bytes to be written.

buffer

The content to be written.

Returns

This method returns the amount of data written, in bytes.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     byte[ ] my_buffer;
     audioObj.writeToSource(ctx, 0, 100, my_buffer);
}
catch(SQLException e){
     .
     .
     .
}

where:

5.2.10 ORDAudio Methods Associated with Source Content Operations

This section presents reference information on the ORDAudio methods associated with source content operations.

See Section 5.2.1 for additional code required to run the example code.


getContentInLob( ) Method

Format

public BLOB getContentInLob(byte[ ] ctx, StringBuffer mimeType,
                            StringBuffer format)
throws SQLException

Scope

public

Description

Gets the local data content from the server-side ORDAudio object in the temporary BLOB.

Parameters

ctx

The source plug-in context information.

mimeType

The MIME type of the temporary BLOB.

format

The format of the temporary BLOB.

Returns

This method returns a BLOB that contains the new contents.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     .
     .
     .
     BLOB blob = audioObj.getContentInLob(ctx, mimeType, format);
}
catch(SQLException e){
     .
     .
     .
}

where:

5.2.11 ORDAudio Methods Associated with Processing Audio Data

This section presents reference information on the ORDAudio methods associated with processing audio data.

See Section 5.2.1 for additional code required to run the example code.


processSourceCommand( ) Method

Format

public byte[ ] processSourceCommand(byte[ ] ctx, String cmd, String args,
                                   byte[ ] result)
throws SQLException

Scope

public

Description

Calls the server-side processSourceCommand( ) on the ORDAudio object.

For more information on the commands that can be processed, see Oracle8i interMedia Audio, Image, and Video User's Guide and Reference.

Parameters

ctx

The source plug-in context information.

cmd

The command that is to be executed.

args

The arguments for the command.

result

The result of the command execution.

Returns

This method returns the result of the command execution.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     String cmd = "compress";
     String arg_list = "compression_type";
     byte[ ] the_result;
     .
     .
     .
     byte[ ] result = audioObj.processSourceCommand(ctx, cmd, arg_list,
          the_result);
}
catch(SQLException e){
     .
     .
     .
}

where:


processAudioCommand( ) Method

Format

public byte[ ] processAudioCommand(byte[ ] ctx, String cmd, String args,
                                  byte[ ] result)
throws SQLException

Scope

public

Description

Calls the server-side processAudioCommand( ) method.

For more information on the commands that can be processed, see Oracle8i interMedia Audio, Image, and Video User's Guide and Reference.

Parameters

ctx

The format plug-in context information.

cmd

The command that is to be executed.

args

The arguments for the command.

result

The result of the command execution.

Returns

This method returns the result of the command execution.

Exceptions

java.sql.SQLException

Usage

try{
     OrdAudio audioObj = new OrdAudio(connection);
     byte[ ] ctx = new byte[4000];
     String cmd = "compress";
     String arg_list = "compression_type";
     byte[ ] the_result;
     .
     .
     .
     byte[ ] result = audioObj.processAudioCommand(ctx, cmd, arg_list,
          the_result);
}
catch(SQLException e){
     .
     .
     .
}

where:




Prev

Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index