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:
Methods that operate on the database BLOB specified by the localData attribute, read and write data stored in the database BLOB.
Methods that operate on the database BFILE specified by the srcLocation and srcName attributes when the srcType attribute is "file," read data from the specified file at the database server.
Methods that operate on the URL specified by the srcType, srcLocation, and srcName attributes when the srcType attribute is "http," read data from the resource at the specified URL.
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.
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:
A connection has been made to a table that contains a column of type OrdVideo.
A local OrdVideo object named vidObj has been created and populated with data.
For examples of making a connection and populating a local object, see Section 2.4.2.
This section presents reference information on the methods that operate on OrdVideo objects.
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
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:
ctx: contains the format plug-in context information.
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( );
Format
public int closeSource(byte[ ] [ ] ctx)
Description
Closes a data source.
Parameters
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:
ctx: contains the source plug-in context information.
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( );
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
The source plug-in context information.
The source type to which the content will be exported.
The source location to which the content will be exported.
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:
ctx: contains the source plug-in context information.
file: is the source plug-in used to export the content.
VIDEODIR: is the location to which the content will be exported.
complete.dat: is the file to which the content will be exported.
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
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:
ctx: contains the format plug-in context information.
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
The format plug-in context information.
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:
ctx: contains the format plug-in context information.
video_duration: is the value of the attribute to get.
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( );
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( );
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( );
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( );
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( );
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
The source plug-in context information.
A String array, 1 element in length, into which the mimeType attribute is written as element 0.
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:
ctx: contains the source plug-in context information.
mimetype: is an array of Strings whose first value contains the MIME type. This value is generated by the server.
format: is an array of Strings whose first value contains the format. This value is generated by the server.
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( );
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
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:
ctx: contains the source plug-in context information.
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( );
Format
public boolean getDataInFile(String filename)
Description
Writes the data from the database BLOB specified by the localData attribute to a local file.
Parameters
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:
output1.dat: is the file into which the data will be loaded.
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( );
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( );
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() );
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( );
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( );
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( );
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( );
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( );
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( );
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( );
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( );
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( );
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( );
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( );
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( );
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( );
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( );
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
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:
ctx: contains the source plug-in information.
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
The source plug-in context information. See Oracle interMedia User's Guide and Reference for more information.
The source type from which the data will be imported.
The source location from which the data will be imported.
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:
ctx: contains the source plug-in context information.
file: is the source plug-in used to import the data.
VIDEODIR: is the location of the file from which the data will be imported.
testvid.dat: is the file from which the data will be imported.
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");
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
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:
data: is the local byte array from which the data will be loaded.
testvid.dat: is a local file that contains 32,000 bytes of data.
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
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:
testvid.dat: is a local file that contains video data.
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
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:
testvid.dat: is a local file that contains video data.
fStream: is the local input stream that will load video data into the OrdVideo object.
Format
public int openSource(byte[ ] userarg, byte[ ] [ ] ctx)
Description
Opens a data source.
Parameters
Additional source plug-in information that may be required by user-defined source plug-ins.
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:
userarg: contains permission-related parameters.
ctx: contains the source plug-in context information.
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
The source plug-in context information. See Oracle interMedia User's Guide and Reference for more information.
The command to be executed by the source plug-in.
The command arguments.
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:
ctx: contains the source plug-in information.
cmd: is the command to be run.
args: contains any arguments required by the command.
result: is the results of executing the command.
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
The format plug-in context information.
The command to be executed by the format plug-in.
The command arguments.
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:
ctx: contains the format plug-in information.
cmd: is the command to be run.
args: contains any arguments required by the command.
result: is the results of executing the command.
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
The source plug-in context information. See Oracle interMedia User's Guide and Reference for more information.
The start position in the data source.
The number of bytes to be read from the data source.
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:
ctx: contains the source plug-in context information.
0: is the position to begin reading from the localData field.
12: is the number of bytes to be read.
buffer: is the location to which the data will be read.
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
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:
1500: is the value to be set, in bits per second, in the bitRate attribute.
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
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:
commentsData: is a CLOB that contains data to be set in the comments attribute.
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
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:
Cinepak: is the value to be set in the compressionType attribute.
Format
public void setDescription(String description)
Description
Sets the value of the description attribute.
Parameters
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:
My video file: is the value to be set in the description attribute.
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
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:
MOOV: is the value to be set in the format attribute.
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
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:
5: is the value to be set, in frames per second, in the frameRate attribute.
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
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:
4: is the value to be set in the frameResolution attribute.
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
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:
24: is the value to be set, in pixels, in the height attribute.
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
The new attribute value, as a String.
The new attribute value, as an integer.
The new attribute value, as an integer.
The new attribute value, as an integer.
The new attribute value, as an integer.
The new attribute value, as an integer.
The new attribute value, as an integer.
The new attribute value, as a String.
The new attribute value, as an integer.
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:
MOOV: is the value to be set in the format attribute.
1: is the value to be set, in pixels, in the width attribute.
2: is the value to be set, in pixels, in the height attribute.
4: is the value to be set in the frameResolution attribute.
5: is the value to be set, in frames per second, in the frameRate attribute.
20: is the value to be set in the videoDuration attribute.
8: is the value to be set in the numberOf Frames attribute.
Cinepak: is the value to be set in the compressionType attribute.
256: is the value to be set in the numberOfColors attribute.
1500: is the value to be set, in bits per second, in the bitRate attribute.
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( );
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
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:
video/avi: is the MIME type to be set.
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
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:
256: is the value to be set in the numberOfColors attribute.
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
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:
8: is the the value to be set in the numberOfFrames attribute.
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
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:
ctx: contains the format plug-in context information.
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
The format plug-in context information.
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:
ctx: contains the format plug-in context information.
true: indicates that the comments field will be populated.
Format
public void setSource(String srcType, String srcLocation, String srcName)
Description
Sets the values of the srcType, srcLocation, and srcName attributes.
Parameters
The type of the source.
The location of the source.
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:
LOCAL: is the source type.
VIDEODIR: is the source location.
video.dat: is the source name.
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
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);
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
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:
20: is the value to be set in the videoDuration attribute.
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
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:
24: is the value to be set, in pixels, in the width attribute.
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
The source plug-in context information. See Oracle interMedia User's Guide and Reference for more information.
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:
ctx: contains the source plug-in context information.
10: is the new length of the source.
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
The source plug-in context information. See Oracle interMedia User's Guide and Reference for more information.
The start position in the data source.
The number of bytes to be written to the data source.
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:
ctx: contains the source plug-in context information.
1: is the position in the comments field where writing will begin.
20: is the number of bytes to be written.
data: contains the content to be written.
|
Copyright © 1999, 2002 Oracle Corporation All rights reserved |
|
Oracle® interMedia Java Classes User's Guide and Reference Release 9.2 Part No. A96121-01 |
|