Skip Headers


Previous Next

8
OrdVideo Reference Information

The OrdVideo class is used to represent an instance of the ORDSYS.ORDVideo database type in a Java application. The OrdVideo class includes a set of methods to get and set various object attributes, as well as a set of methods that perform various operations on an OrdVideo Java object.

Almost all methods operate on the attributes of the OrdVideo Java object in the application. The exceptions are those methods that access the video data for read or write purposes, which are described in the following list:

If your application modifies the OrdVideo Java object, or the video data in the database, you must update the ORDVideo SQL object in the database to make those changes permanent.

Some methods in the OrdVideo Java class are handed off to a database source plug-in or database format plug-in for processing; these methods have byte [ ] [ ] ctx as a context parameter. Applications should allocate a 64-byte array to hold any context information that may be required by a source plug-in or a format plug-in. For example, a plug-in may initialize the context information in one call and use that information in a subsequent call. The source plug-in context requires one array; the format plug-in context requires another array. For most plug-ins, 64 bytes should be sufficient. Some user-defined plug-ins may need additional space. The following example shows how to allocate a plug-in context information array:

byte [] [] ctx = new byte[1][64];


Note:

In the current release, no Oracle-supplied source plug-ins or format plug-ins maintain context. Also, not all user-written source plug-ins or format plug-ins maintain context. However, if you include the context parameter as described, your application should work with any current or future source plug-ins or format plug-ins.

See Oracle interMedia User's Guide and Reference for more information about plug-ins.

8.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.4.2.

8.2 Reference Information

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


checkProperties( )

Format

public boolean checkProperties(byte[ ] [ ] ctx)

Description

Checks if the properties of the video data are consistent with the attributes of the OrdVideo Java object.

Parameters

ctx

The format plug-in context information.

Return Value

This method returns true if the properties of the video data are consistent with the attributes of the OrdVideo Java object; false otherwise.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding checkProperties( ) method in the database.

Examples

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

where:


clearLocal( )

Format

public void clearLocal( )

Description

Clears the local attribute to indicate that the video data is stored externally.

Parameters

None.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the local attribute.

Examples

vidObj.clearLocal( );

closeSource( )

Format

public int closeSource(byte[ ] [ ] ctx)

Description

Closes a data source.

Parameters

ctx

The source plug-in context information.

Return Value

This method returns the status as an integer, where zero indicates success and a non-zero value indicates a failure code specific to the source plug-in.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding closeSource( ) method in the database.

Examples

byte [ ] [ ] ctx = new byte[1][64];
int i = vidObj.closeSource(ctx);
if(i == 0)
     System.out.println("closeSource successful");

where:


deleteContent( )

Format

public void deleteContent( )

Description

Deletes any data stored in the database BLOB specified by the localData attribute.

Parameters

None.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding deleteContent( ) method in the database.

Examples

vidObj.deleteContent( );


export( )

Format

public void export (byte[ ] [ ] ctx, String srcType, String srcLocation, String srcName)

Description

Exports the data from the BLOB specified by the localData attribute. This method calls the corresponding export( ) method in the database to export the video data to a location specified by the srcType, srcLocation, and srcName parameters.

Not all source plug-ins support this method. Only the "file" source type is natively supported.

This method will work only if you are running Oracle database server release 8.1.7 or later.

The remainder of this description describes the use of the export( ) method and the Oracle-supplied "file" source plug-in. User-written plug-ins will behave differently.

The export( ) method implemented by the "file" source plug-in copies, but does not modify, the video data stored in the database BLOB specified by the localData attribute.

After exporting the video data, all the video property attributes remain unchanged. However, the srcType, srcLocation, and srcName attributes are updated with values of the srcType, srcLocation, and srcName parameters passed to the export( ) method. After calling the export( ) method, if you no longer intend to manage the video data within the database, call the clearLocal( ) method to indicate the video data is stored outside the database, and call the deleteContent( ) method to delete the video data stored in the database BLOB.

The export( ) method in the database writes only to a database directory object that the user has privileges to access. That is, you can access a directory that you have created using the SQL CREATE DIRECTORY statement, or one to which you have been granted READ access. To execute the CREATE DIRECTORY statement, you must have the CREATE ANY DIRECTORY privilege. In addition, you must use the DBMS_JAVA.GRANT_PERMISSION method to specify which files can be written.

For example, the following SQL*Plus command grants the user, MEDIAUSER, the permission to write to the file named movie1.mov:

  CALL DBMS_JAVA.GRANT.PERMISSION(
'MEDIAUSER',
'java.io.FilePermission',
'/videos/filmclips/movie1.mov',
'write');

The previous example shows how to authorize access to write to a single file. In addition, there are various wildcard path specifications that authorize write access to multiple directories and file names. For example, a path specification that ends in a slash and asterisk (/*), where the slash is the file-separator character that is operating-system dependent, indicates all the files contained in the specified directory. A path specification that ends with a slash and hyphen (/-) indicates all files contained in the specified directory and all its subdirectories. A path name consisting of the special token <<ALL FILES>> authorizes access to any file.

See Oracle9i Java Developer's Guide and the java.io.FilePermission class in the Java API for more information about security and performance. See Oracle interMedia User's Guide and Reference for more information about the required privileges.

Parameters

ctx

The source plug-in context information.

srcType

The source type to which the content will be exported.

srcLocation

The source location to which the content will be exported.

srcName

The source name to which the content will be exported.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding export( ) method in the database.

Examples

byte [ ] [ ] ctx = new byte[1][64];
vidObj.export(ctx,"file","VIDEODIR","complete.dat");

where:


getAllAttributes( )

Format

public oracle.sql.CLOB getAllAttributes(byte[ ] [ ] ctx)

Description

Returns the values of the video properties in a temporary CLOB in a form defined by the format plug-in. For natively supported formats, the information is presented as a comma-separated list of attributes in the form attributeName=attributeValue, where the list contains the following attributes: format, mimeType, width, height, frameResolution, frameRate, videoDuration, numberOfFrames, compressionType, numberOfColors, and bitRate. For user-defined formats, the information is presented in a form defined by the format plug-in.


Note:

The application must free the temporary CLOB after reading the information it contains.

Parameters

ctx[ ]

The format plug-in context information.

Return Value

This method returns the values of the attributes as a temporary oracle.sql.CLOB.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding getAllAttributes( ) method in the database.

Examples

byte [ ] [ ] ctx = new byte[1][64];
CLOB attributes = vidObj.getAllAttributes(ctx);

where:


getAttribute( )

Format

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

Description

Returns the value of the requested video property. This method is used by user-defined format plug-ins to return the value of a video property that is not available as an attribute of the OrdVideo Java object. This method is not implemented by any Oracle-supplied format plug-ins.

Parameters

ctx

The format plug-in context information.

name

The property or attribute name.

Return Value

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

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding getAttribute( ) method in the database.

Examples

byte [ ] [ ] ctx = new byte[1][64];
String attribute = vidObj.getAttribute(ctx, video_duration);

where:


getBFILE( )

Format

public oracle.sql.BFILE getBFILE( )

Description

Returns a BFILE locator from the database when the srcType attribute is "file". This method calls the corresponding getBFILE( ) method in the database, which creates the BFILE using the srcLocation and srcName attributes.

Parameters

None.

Return Value

This method returns an oracle.sql.BFILE locator.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding getBFILE( ) method in the database.

Examples

BFILE videoBFILE = vidObj.getBFILE( );

getBitRate( )

Format

public int getBitRate( )

Description

Returns the value of the bitRate attribute.

Parameters

None.

Return Value

This method returns the value of the bitRate attribute, as an integer.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the bitRate attribute.

Examples

int bitRate = vidObj.getBitRate( );

getComments( )

Format

public oracle.sql.CLOB getComments( )

Description

Returns the CLOB locator from the comments attribute.

Parameters

None.

Return Value

This method returns the value of the comments attribute as an oracle.sql.CLOB locator.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the comments attribute.

Examples

CLOB comments = vidObj.getComments( );

getCompressionType( )

Format

public String getCompressionType( )

Description

Returns the value of the compressionType attribute.

Parameters

None.

Return Value

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

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the compressionType attribute.

Examples

String compressionType = vidObj.getCompressionType( );

getContent( )

Format

public oracle.sql.BLOB getContent( )

Description

Returns the BLOB locator from the localData attribute.

Parameters

None.

Return Value

This method returns an oracle.sql.BLOB locator.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the localData attribute.

Examples

BLOB localContent = vidObj.getContent( );

getContentInLob( )

Format

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

Description

Returns the data from the BLOB specified by the localData attribute in a temporary BLOB in the database. This method creates a temporary BLOB in the database, reads the data from the BLOB specified by the localData attribute, writes the data to the temporary BLOB, then returns the temporary BLOB locator to the caller.


Note:

The application must free the temporary BLOB after accessing the data it contains.

Parameters

ctx

The source plug-in context information.

mimetype

A String array, 1 element in length, into which the mimeType attribute is written as element 0.

format

A String array, 1 element in length, into which the format attribute is written as element 0.

Return Value

This method returns the video data in a temporary oracle.sql.BLOB locator.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs creating the temporary BLOB or executing the corresponding getContentInLob( ) method in the database.

Examples

byte [ ] [ ] ctx = new byte[1][64];
String mimetype[ ] = new String[1];
String format[ ] = new String[1];
BLOB localContent = vidObj.getContentInLob(ctx,mimetype,format);

where:


getContentLength( )

Format

public int getContentLength( )

Description

Returns the length of the video data. This method calls the corresponding getContentLength( ) method in the database.

This method is not supported for all source types. For example, the "http" source type does not support this method.

Parameters

None.

Return Value

This method returns the value of the contentLength attribute, as an integer.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding getContentLength( ) method in the database.

Examples

int contentLength = vidObj.getContentLength( );

getContentLength(byte[ ][ ])

Format

public int getContentLength(byte[ ] [ ] ctx)

Description

Returns the length of the video data using source plug-in context information. This method calls the corresponding getContentLength( ) method in the database.

Parameters

ctx

The source plug-in context information.

Return Value

This method returns the value of the contentLength attribute, as an integer.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding getContentLength( ) method in the database.

Examples

byte [ ] [ ] ctx = new byte[1][64];
int contentLength = vidObj.getContentLength(ctx);

where:


getDataInByteArray( )

Format

public byte[ ] getDataInByteArray( )

Description

Returns a byte array containing the data from the database BLOB specified by the localData attribute.

Parameters

None.

Return Value

This method returns a byte array containing the data.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing an object attribute.

java.io.IOException

This exception is thrown if an error occurs reading the data from the BLOB.

java.lang.OutOfMemoryError

This exception is thrown if sufficient memory cannot be allocated to hold the data.

Examples

byte[ ] byteArr = vidObj.getDataInByteArray( );

getDataInFile( )

Format

public boolean getDataInFile(String filename)

Description

Writes the data from the database BLOB specified by the localData attribute to a local file.

Parameters

filename

The name of the file to which the data will be written.

Return Value

This method returns true if the data is written to the file successfully; otherwise, an exception is raised if an error occurs. This method never returns false.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing an object attribute.

java.io.IOException

This exception is thrown if an error occurs reading the data from the BLOB or writing the data to the output file.

Examples

boolean load = vidObj.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

Returns an InputStream object from which the data in the database BLOB specified by the localData attribute can be read.

Parameters

None.

Return Value

This method returns an InputStream object from which the data will be read.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing an object attribute.

Examples

InputStream inpStream = vidObj.getDataInStream( );

getDescription( )

Format

public String getDescription( )

Description

Returns the value of the description attribute.

Parameters

None.

Return Value

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

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the description attribute.

Examples

String description = vidObj.getDescription( );

getFactory( )

Format

public static oracle.sql.CustomDatumFactory getFactory( )

Description

Returns the OrdVideo CustomDatumFactory interface for use by the getCustomDatum( ) method. Specify the getFactory( ) method as the factory parameter of the getCustomDatum( ) method when retrieving an OrdVideo object from an OracleResultSet or OracleCallableStatement object.

Parameters

None.

Return Value

This method returns the OrdVideo implementation of the CustomDatumFactory interface.

Exceptions

None.

Examples

OrdVideo vid = (OrdVideo)rset.getCustomDatum( 1, OrdVideo.getFactory() );


getFormat( )

Format

public String getFormat( )

Description

Returns the value of the format attribute.

Parameters

None.

Return Value

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

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the format attribute.

Examples

String format = vidObj.getFormat( );

getFrameRate( )

Format

public int getFrameRate( )

Description

Returns the value of the frameRate attribute.

Parameters

None.

Return Value

This method returns the value of the frameRate attribute, as an integer.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the frameRate attribute.

Examples

int frameRate = vidObj.getFrameRate( );

getFrameResolution( )

Format

public int getFrameResolution( )

Description

Returns the value of the frameResolution attribute.

Parameters

None.

Return Value

This method returns the value of the frameResolution attribute, as an integer.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the frameResolution attribute.

Examples

int frameResolution = vidObj.getFrameResolution( );

getHeight( )

Format

public int getHeight( )

Description

Returns the value of the height attribute.

Parameters

None.

Return Value

This method returns the value of the height attribute, as an integer.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the height attribute.

Examples

int height = vidObj.getHeight( );

getMimeType( )

Format

public String getMimeType( )

Description

Returns the value of the mimeType attribute.

Parameters

None.

Return Value

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

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the mimeType attribute.

Examples

String mimeType = vidObj.gtMimeType( );

getNumberOfColors( )

Format

public int getNumberOfColors( )

Description

Returns the value of the numberOfColors attribute.

Parameters

None.

Return Value

This method returns the value of the numberOfColors attribute, as an integer.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the numberOfColors attribute.

Examples

int numberOfColors = vidObj.getNumberOfColors( );

getNumberOfFrames( )

Format

public int getNumberOfFrames( )

Description

Returns the value of the numberOfFrames attribute.

Parameters

None.

Return Value

This method returns the value of the numberOfFrames attribute, as an integer.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the numberOfFrames attribute.

Examples

int numberOfFrames = vidObj.getNumberOfFrames( );

getSource( )

Format

public String getSource( )

Description

Returns the source information in the form srcType://srcLocation/srcName.

Parameters

None.

Return Value

This method returns the source information, as a String.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding getSource( ) method in the database.

Examples

String source = viObj.getSource( );

getSourceLocation( )

Format

public String getSourceLocation( )

Description

Returns the value of the srcLocation attribute.

Parameters

None.

Return Value

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

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the srcLocation attribute.

Examples

String location = vidObj.getSourceLocation( );

getSourceName( )

Format

public String getSourceName( )

Description

Returns the value of the srcName attribute.

Parameters

None.

Return Value

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

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the srcName attribute.

Examples

String name = vidObj.getSourceName( );

getSourceType( )

Format

public String getSourceType( )

Description

Returns the value of the srcType attribute.

Parameters

None.

Return Value

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

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the srcType attribute.

Examples

String type = vidObj.getSourceType( );

getUpdateTime( )

Format

public java.sql.Timestamp getUpdateTime( )

Description

Returns the value of the updateTime attribute.

Parameters

None.

Return Value

This method returns the value of the updateTime attribute as a java.sql.Timestamp object.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the updateTime attribute.

Examples

Timestamp time = vidObj.getUpdateTime( );

getVideoDuration( )

Format

public int getVideoDuration( )

Description

Returns the value of the videoDuration attribute.

Parameters

None.

Return Value

This method returns the value of the videoDuration attribute, as an integer.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the videoDuration attribute.

Examples

int videoDuration = vidObj.getVideoDuration( );

getWidth( )

Format

public int getWidth( )

Description

Returns the value of the width attribute.

Parameters

None.

Return Value

This method returns the value of the width attribute, as an integer.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the width attribute.

Examples

int width = vidObj.getWidth( );

importData( )

Format

public void importData(byte[ ] [ ] ctx)

Description

Imports data from an external source into the database BLOB specified by the localData attribute. The external data source is specified by the srcType, srcLocation, and srcName attributes.

Parameters

ctx

The source plug-in context information.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding import( ) method in the database.

Examples

byte [ ] [ ] ctx = new byte[1][64];
vidObj.importData(ctx);

where:


importFrom( )

Format

public void importFrom(byte[ ] [ ] ctx, String srcType, String srcLocation, String srcName)

Description

Imports data from an external source into the database BLOB specified by the localData attribute. The external data source is specified by the srcType, srcLocation, and srcName parameters. The srcType, srcLocation, and srcName attributes are updated with values of the srcType, srcLocation, and srcName parameters passed to the importFrom( ) method.

Parameters

ctx

The source plug-in context information. See Oracle interMedia User's Guide and Reference for more information.

srcType

The source type from which the data will be imported.

srcLocation

The source location from which the data will be imported.

srcName

The source name from which the data will be imported.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding importFrom( ) method in the database.

Examples

byte [ ] [ ] ctx = new byte[1][64];
vidObj.importFrom(ctx,"file","VIDEODIR","testvid.dat");

where:


isLocal( )

Format

public boolean isLocal( )

Description

Indicates if the video data is stored locally in the database in a BLOB specified by the localData attribute.

Parameters

None.

Return Value

This method returns true if the data is stored locally in the database in a BLOB; false otherwise.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the localData attribute.

Examples

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

loadDataFromByteArray( )

Format

public boolean loadDataFromByteArray(byte[ ] byteArr)

Description

Loads data from a byte array into the database BLOB specified by the localData attribute. Before loading the data, this method calls the deleteContent( ) method to delete any existing data in the BLOB. It also calls the setLocal( ) method to set the local flag. In addition, this method calls the setUpdateTime( ) method to set the updateTime attribute to the database server's current SYSDATE time.

Parameters

byteArr

A byte array from which the data will be loaded.

Return Value

This method returns true if the data is loaded successfully; otherwise, an exception is raised if an error occurs. This method never returns false.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing an object attribute or executing a method in the database.

java.io.IOException

This exception is thrown if an error occurs reading the byte array.

Examples

byte[ ] data = new byte[32000];
FileInputStream fStream = new FileInputStream("testvid.dat");
fStream.read(data,0,32000);
boolean success = vidObj.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 a file into the database BLOB specified by the localData attribute. Before loading the data, this method calls the deleteContent( ) method to delete any existing data in the BLOB. It also calls the setLocal( ) method to set the local flag. In addition, this method calls the setUpdateTime( ) method to set the updateTime attribute to the database server's current SYSDATE time.

Parameters

filename

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

Return Value

This method returns true if the data is loaded successfully; otherwise, an exception is raised if an error occurs. This method never returns false.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing an object attribute or executing a method in the database.

java.io.IOException

This exception is thrown if an error occurs reading the data file.

Examples

vidObj.loadDataFromFile("testvid.dat");

where:


loadDataFromInputStream( )

Format

public boolean loadDataFromInputStream(InputStream inpStream)

Description

Loads data from an InputStream object into the database BLOB specified by the localData attribute. Before loading the data, this method calls the deleteContent( ) method to delete any existing data in the BLOB. It also calls the setLocal( ) method to set the local flag. In addition, this method calls the setUpdateTime( ) method to set the updateTime attribute to the database server's current SYSDATE time.

Parameters

inpStream

The InputStream object from which the data will be loaded.

Return Value

This method returns true if the data is loaded successfully; otherwise, an exception is raised if an error occurs. This method never returns false.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing an object attribute or executing a method in the database.

java.io.IOException

This exception is thrown if an error occurs reading the InputStream object.

Examples

FileInputStream fStream = new FileInputStream("testvid.dat");
vidObj.loadDataFromInputStream(fStream);

where:


openSource( )

Format

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

Description

Opens a data source.

Parameters

userarg

Additional source plug-in information that may be required by user-defined source plug-ins.

ctx

The source plug-in context information. See Oracle interMedia User's Guide and Reference for more information.

Return Value

This method returns the status as an integer, where zero indicates success and a non-zero value indicates a failure code specific to the source plug-in.

Exceptions

java.lang.Exception

This exception is thrown if an error occurs executing the corresponding openSource( ) method in the database.

Examples

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

where:


processSourceCommand( )

Format

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

Description

Calls the source plug-in in the database to execute a command. This method is used with user-written plug-ins only; this method raises an exception if used with the source plug-ins supplied by Oracle.

Parameters

ctx

The source plug-in context information. See Oracle interMedia User's Guide and Reference for more information.

cmd

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

args

The command arguments.

result

A byte array of the form [1][n] into which the result of the command execution is written.

Return Value

This method returns the results of executing the command.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding processSourceCommand( ) method in the database.

Examples

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

where:


processVideoCommand( )

Format

public byte[ ] processVideoCommand(byte[ ] [ ] ctx, String cmd, String args, byte[ ] [ ] result)

Description

Calls the format plug-in in the database to execute a command. This method is used with user-written format plug-ins only; this method raises an exception if used with the format plug-ins supplied by Oracle.

Parameters

ctx

The format plug-in context information.

cmd

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

args

The command arguments.

result

A byte array of the form [1][n] into which the result of the command execution is written.

Return Value

This method returns the results of executing the command.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding processVideoCommand( ) method in the database.

Examples

byte [ ] [ ] ctx = new byte[1][64]
String cmd;
String args;
byte [ ] [ ] result;
//assign a command value to cmd
//assign any arguments to args
byte[ ] commandResults = vidObj.processVideoCommand(ctx,cmd,
     args,result);

where:


readFromSource( )

Format

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

Description

Reads data from the data source. This method reads the specified number of bytes into the application buffer from the data source starting at the specified position in the data source.

Not all source plug-ins require that the data source be opened before it can be read. However, to ensure that an application will work with any current or future source plug-ins, call the openSource( ) method before calling this method.

Parameters

ctx

The source plug-in context information. See Oracle interMedia User's Guide and Reference for more information.

startpos

The start position in the data source.

numbytes

The number of bytes to be read from the data source.

buffer

A byte array of the form [1][n], where n is greater than or equal to numbytes.

Return Value

This method returns the number of bytes read, as an integer.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding readFromSource( ) method in the database.

Examples

byte [ ] [ ] ctx = new byte[1][64];
byte [ ] [ ] buffer = new byte[12];
int i = vidObj.readFromSource(ctx,0,12,buffer);

where:


setBitRate( )

Format

public void setBitRate(int bitRate)

Description

Sets the value of the bitRate attribute.

The setProperties( ) method sets this attribute automatically for certain video formats; use this method only if you are not using the setProperties( ) method. This method sets only the attribute value; it does not modify the video data itself.

Parameters

bitRate

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the bitRate attribute.

Examples

vidObj.setBitRate(1500);

where:


setComments( )

Format

public void setComments(oracle.sql.CLOB comments)

Description

Sets the value of the comments attribute.

The comments attribute is reserved for use by interMedia. You can set your own value, but it could be overwritten by Oracle interMedia Annotator or by the setProperties( ) method.

Parameters

comments

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the comments attribute.

Examples

vidObj.setComments(commentsData);

where:


setCompressionType( )

Format

public void setCompressionType(String compressionType)

Description

Sets the value of the compressionType attribute.

The setProperties( ) method sets this attribute automatically for certain video formats; use this method only if you are not using the setProperties( ) method. This method sets only the attribute value; it does not modify the video data itself.

Parameters

compressionType

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the compressionType attribute.

Examples

vidObj.setCompressionType("Cinepak");

where:


setDescription( )

Format

public void setDescription(String description)

Description

Sets the value of the description attribute.

Parameters

description

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the description attribute.

Examples

vidObj.setDescription("My video file");

where:


setFormat( )

Format

public void setFormat(String format)

Description

Sets the value of the format attribute.

The format attribute determines which format plug-in is used to handle calls to methods that operate on the video data. In particular, the setProperties( ) method uses the format attribute to determine which format plug-in to call to parse the video data properties. See the setProperties( ) method for more information on how to initialize the format attribute before calling the setProperties( ) method, and for information on how the setProperties( ) method in the default, Oracle-supplied plug-in, sets the value of the format attribute. Calling the setFormat( ) method sets only the attribute value; it does not modify the video data itself.

Parameters

format

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the format attribute.

Examples

vidObj.setFormat("MOOV");

where:


setFrameRate( )

Format

public void setFrameRate(int frameRate)

Description

Sets the value of the frameRate attribute.

The setProperties( ) method sets this attribute automatically for certain video formats; use this method only if you are not using the setProperties( ) method. This method sets only the attribute value; it does not modify the video data itself.

Parameters

frameRate

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the frameRate attribute.

Examples

vidObj.setFrameRate(5);

where:


setFrameResolution( )

Format

public void setFrameResolution(int frameResolution)

Description

Sets the value of the frameResolution attribute.

The setProperties( ) method sets this attribute automatically for certain video formats; use this method only if you are not using the setProperties( ) method. This method sets only the attribute value; it does not modify the video data itself.

Parameters

frameResolution

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the frameResolution attribute.

Examples

vidObj.setFrameResolution(4);

where:


setHeight( )

Format

public void setHeight(int height)

Description

Sets the value of the height attribute.

The setProperties( ) method sets this attribute automatically for certain video formats; use this method only if you are not using the setProperties( ) method. This method sets only the attribute value; it does not modify the video data itself.

Parameters

height

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the height attribute.

Examples

vidObj.setHeight(24);

where:


setKnownAttributes( )

Format

public void setKnownAttributes(String format, int width, int height, int frameResolution,
int frameRate, int videoDuration, int numberOfFrames,
String compressionType, int numberOfColors,
int bitRate)

Description

Sets the values of the known attributes of the OrdVideo Java object.

The setProperties( ) method sets the values of the following attributes automatically for certain video formats: format, width, height, frameResolution, frameRate, videoDuration, numberOfFrames, compressionType, numberOfColors, and bitRate. Use this method only if you are not using the setProperties( ) method. This method sets only the specified attribute values; it does not modify the video data itself.

Parameters

format

The new attribute value, as a String.

width

The new attribute value, as an integer.

height

The new attribute value, as an integer.

frameResolution

The new attribute value, as an integer.

frameRate

The new attribute value, as an integer.

videoDuration

The new attribute value, as an integer.

numberOfFrames

The new attribute value, as an integer.

compressionType

The new attribute value, as a String.

numberOfColors

The new attribute value, as an integer.

bitRate

The new attribute value, as an integer.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding setKnownAttributes( ) method in the database.

Examples

vidObj.setKnownAttributes("MOOV",1,2,4,5,20,8,"Cinepak",256,1500);

where:


setLocal( )

Format

public void setLocal( )

Description

Sets the value of the local attribute to indicate that the video data is stored locally in the database in a BLOB specified by the localData attribute.

Parameters

None.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the localData attribute.

Examples

vidObj.setLocal( );

setMimeType( )

Format

public void setMimeType(String mimeType)

Description

Sets the value of the mimeType attribute.

The setProperties( ) method sets this attribute automatically for certain video formats; use this method only if you are not using the setProperties( ) method. This method sets only the attribute value; it does not modify the video data itself.

Parameters

mimeType

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the mimeType attribute.

Examples

vidObj.setMimeType("video/avi");

where:


setNumberOfColors( )

Format

public void setNumberOfColors(int numberOfColors)

Description

Sets the value of the numberOfColors attribute.

The setProperties( ) method sets this attribute automatically for certain video formats; use this method only if you are not using the setProperties( ) method. This method sets only the attribute value; it does not modify the video data itself.

Parameters

numberOfColors

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the numberOfColors attribute.

Examples

vidObj.setNumberOfColors(256);

where:


setNumberOfFrames( )

Format

public void setNumberOfFrames(int numberOfFrames)

Description

Sets the value of the numberOfFrames attribute.

The setProperties( ) method sets this attribute automatically for certain video formats; use this method only if you are not using the setProperties( ) method. This method sets only the attribute value; it does not modify the video data itself.

Parameters

numberOfFrames

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the numberOfFrames attribute.

Examples

vidObj.setNumberOfFrames(8);

where:


setProperties(byte[ ][ ])

Format

public void setProperties(byte[ ] [ ] ctx)

Description

Parses the video data properties and sets the values of the attributes in the OrdVideo Java object. This method sets the values of the format, mimeType, width, height, frameResolution, frameRate, videoDuration, numberOfFrames, compressionType, numberOfColors, and bitRate attributes. An attribute is set to null if the corresponding property cannot be extracted for a specific video format. This method throws a SQLException error if the video format is not recognized.

The format attribute determines which format plug-in is used to parse the video data properties. If the format attribute is null when the setProperties( ) method is called, then the default, Oracle-supplied, format plug-in is used to parse the video data properties and fill in various attributes, including the actual video data format, for supported video formats. See Oracle interMedia User's Guide and Reference for information on the video formats supported by the Oracle-supplied format plug-ins. Note that the ORDVideo.init methods in the database always set the value of the format attribute to null. If the format attribute is not null, then the format plug-in specified by the format attribute will be called when the setProperties( ) method is called.

Parameters

ctx

The format plug-in context information.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding setProperties( ) method in the database.

Examples

byte [ ] [ ] ctx = new byte[1][64];
vidObj.setProperties(ctx);

where:


setProperties(byte[ ][ ], boolean)

Format

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

Description

Parses the video data properties, sets the values of the attributes in the OrdVideo Java object, and optionally populates the CLOB specified by the comments attribute. This method sets the values of the format, mimeType, width, height, frameResolution, frameRate, videoDuration, numberOfFrames, compressionType, numberOfColors, and bitRate attributes. An attribute is set to null if the corresponding property cannot be extracted for a specific video format. If the setComments parameter is true, this method also populates the CLOB specified by the comments attribute with all extracted properties in XML form. If the setComments parameter is false, the comments attribute is not modified. This method throws a SQLException error if the video format is not recognized.

The format attribute determines which format plug-in is used to parse the video data properties. If the format attribute is null when the setProperties( ) method is called, then the default, Oracle-supplied, format plug-in is used to parse the video data properties and fill in various attributes, including the actual video data format, for supported video formats. See Oracle interMedia User's Guide and Reference for information on the video formats supported by the Oracle-supplied format plug-ins. Note that the ORDVideo.init methods in the database always set the value of the format attribute to null. If the format attribute is not null, then the format plug-in specified by the format attribute will be called when the setProperties( ) method is called.

Parameters

ctx

The format plug-in context information.

setComments

A Boolean value that specifies whether or not to populate the CLOB specified by the comments attribute.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding setProperties( ) method in the database.

Examples

byte [ ] [ ] ctx = new byte[1][64];
vidObj.setProperties(ctx,true);

where:


setSource( )

Format

public void setSource(String srcType, String srcLocation, String srcName)

Description

Sets the values of the srcType, srcLocation, and srcName attributes.

Parameters

srcType

The type of the source.

srcLocation

The location of the source.

srcName

The name of the source.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the srcType, srcLocation, or srcName attributes.

Examples

vidObj.setSource("LOCAL","VIDEODIR","video.dat");

where:


setUpdateTime( )

Format

public void setUpdateTime(java.sql.Timestamp currentTime)

Description

Sets the value of the updateTime attribute. This method sets the value of the updateTime attribute to the specified time, or to the database server's current SYSDATE time if currentTime is specified as null.

Parameters

currentTime

The update time, or the null value, used to set the value of the updateTime attribute to the database server's current SYSDATE time.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding setUpdateTime( ) method in the database.

Examples

vidObj.setUpdateTime(null);


setVideoDuration( )

Format

public void setVideoDuration(int videoDuration)

Description

Sets the value of the videoDuration attribute.

The setProperties( ) method sets this attribute automatically for certain video formats; use this method only if you are not using the setProperties( ) method. This method sets only the attribute value; it does not modify the video data itself.

Parameters

videoDuration

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the videoDuration attribute.

Examples

vidObj.setVideoDuration(20);

where:


setWidth( )

Format

public void setWidth(int width)

Description

Sets the value of the width attribute.

The setProperties( ) method sets this attribute automatically for certain video formats; use this method only if you are not using the setProperties( ) method. This method sets only the attribute value; it does not modify the video data itself.

Parameters

width

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs accessing the width attribute.

Examples

vidObj.setWidth(24);

where:


trimSource( )

Format

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

Description

Trims the data to the specified length.

Not all source plug-ins support trim operations. For example, applications can trim the data stored in a BLOB specified by the localData attribute; however, the "file" and "http" data source types do not support write access, and so do not support this method. Furthermore, those source plug-ins that do support write access may not support the trim operation.

Not all source plug-ins require that the data source be opened before it can be modified. However, to ensure that an application will work with any current or future source plug-ins, call the openSource( ) method before calling this method.

Parameters

ctx

The source plug-in context information. See Oracle interMedia User's Guide and Reference for more information.

newLen

The length to which the data is to be trimmed.

Return Value

This method returns the status as an integer, where zero indicates success and a non-zero value indicates a failure code specific to the source plug-in.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding
trimSource( ) method in the database.

Examples

byte [ ] [ ] ctx = new byte[1][64];
int i = vidObj.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 data source. This method writes the specified number of bytes from the application buffer to the data source starting at the specified position in the data source. Not all source plug-ins support write operations. For example, applications can write to a BLOB specified by the localData attribute; however, the "file" and "http" data source types do not support write access, and so do not support this method. Furthermore, those source plug-ins that do support write access may support only sequential write access, and may not support write access to arbitrary starting positions within the data source.

Not all source plug-ins require that the data source be opened before it can be written. However, to ensure that an application will work with any current or future source plug-ins, call the openSource( ) method before calling this method.

Parameters

ctx

The source plug-in context information. See Oracle interMedia User's Guide and Reference for more information.

startpos

The start position in the data source.

numbytes

The number of bytes to be written to the data source.

buffer

A byte array containing the data to be written.

Return Value

This method returns the number of bytes written, as an integer.

Exceptions

java.sql.SQLException

This exception is thrown if an error occurs executing the corresponding writeToSource( ) method in the database.

Examples

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

where:




Previous Next
Oracle Logo
Copyright © 1999, 2002 Oracle Corporation

All rights reserved
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback
Oracle® interMedia Java Classes User's Guide and Reference
Release 9.2
Part No. A96121-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback