Oracle9i Business Components for Java InterMedia API Reference
Oracle9i JDeveloper (9.0.4)
B10394-01

oracle.ord.im
Class OrdVideo

java.lang.Object
  |
  +--oracle.ord.im.OrdVideoBase
        |
        +--oracle.ord.im.OrdVideo
All Implemented Interfaces:
oracle.sql.CustomDatum, oracle.sql.CustomDatumFactory, oracle.jdbc.internal.ObjectData, oracle.jdbc.internal.ObjectDataFactory
Direct Known Subclasses:
OrdVideoDomain

public class OrdVideo
extends oracle.ord.im.OrdVideoBase

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, plus a set of methods that perform various operations on an OrdVideo Java object.

Users of this class are assumed to be familiar with Oracle interMedia Java Classes User's Guide and Reference and Oracle interMedia User's Guide and Reference.

All methods operate on the attributes of the OrdVideo Java object in the application with the exception of those methods that access the video data for read or write purposes.

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 OrdAudio 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. Note that one array is required for source plug-in context and another array is required for format plug-in context. Note that 64 bytes should be sufficient for most plug-ins, however, some user-defined plug-ins may need additional space. The following example illustrates 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.

Field Summary

 

Fields inherited from class oracle.ord.im.OrdVideoBase
_SQL_NAME, _SQL_TYPECODE

 

Constructor Summary
OrdVideo()
          Internal constructor used only by the Oracle CustomDatum interface factory method to create an instance of the class.

 

Method Summary
 boolean checkProperties(byte[][] ctx)
          Checks if the properties of the video data are consistent with the attributes of the OrdVideo Java object.
 void clearLocal()
          Clears the local attribute to indicate that the video data is stored externally.
 int closeSource(byte[][] ctx)
          Closes a data source.
 oracle.sql.CustomDatum create(oracle.sql.Datum d, int sqlType)
          Internal method used only by the Oracle CustomDatum interface.
 void deleteContent()
          Deletes any data stored in the database BLOB specified by the localData attribute.
 void export(byte[][] ctx, java.lang.String srcType, java.lang.String srcLocation, java.lang.String srcName)
          Exports the data from the BLOB specified by the localData attribute.
 oracle.sql.CLOB getAllAttributes(byte[][] ctx)
          Returns the video properties in a temporary CLOB in a form defined by the format plug-in.
 java.lang.String getAttribute(byte[][] ctx, java.lang.String name)
          Returns the value of the requested video property.
 oracle.sql.BFILE getBFILE()
          Returns a BFILE locator from the database when the srcType attribute is "FILE".
 int getBitRate()
          Returns the bitRate attribute.
 oracle.sql.CLOB getComments()
          Returns the CLOB locator from the comments attribute.
 java.lang.String getCompressionType()
          Returns the compressionType attribute.
 oracle.sql.BLOB getContent()
          Returns the BLOB locator from the localData attribute.
 oracle.sql.BLOB getContentInLob(byte[][] ctx, java.lang.String[] mimetype, java.lang.String[] format)
          Returns the data from the BLOB specified by the localData attribute in a temporary BLOB in the database.
 int getContentLength()
          Returns the length of the video data.
 int getContentLength(byte[][] ctx)
          Returns the length of the video data using source plug-in context information.
 byte[] getDataInByteArray()
          Returns a byte array containing the data from the database BLOB specified by the localData attribute.
 boolean getDataInFile(java.lang.String filename)
          Writes the data from the database BLOB specified by the localData attribute to a local file.
 java.io.InputStream getDataInStream()
          Returns an InputStream from which the data in the database BLOB specified by the localData attribute can be read.
 java.lang.String getDescription()
          Returns the description attribute.
static oracle.sql.CustomDatumFactory getFactory()
          Returns the OrdVideo CustomDatumFactory for use by the getCustomDatum method.
 java.lang.String getFormat()
          Returns the format attribute.
 int getFrameRate()
          Returns the frameRate attribute.
 int getFrameResolution()
          Returns the frameResolution attribute.
 int getHeight()
          Returns the height attribute.
 java.lang.String getMimeType()
          Returns the mimeType attribute.
 int getNumberOfColors()
          Returns the numberOfColors attribute.
 int getNumberOfFrames()
          Returns the numberOfFrames attribute.
 java.lang.String getSource()
          Returns the source information in the form srcType://srcLocation/srcName.
 java.lang.String getSourceLocation()
          Returns the srcLocation attribute.
 java.lang.String getSourceName()
          Returns the srcName attribute.
 java.lang.String getSourceType()
          Returns the srcType attribute.
 java.sql.Timestamp getUpdateTime()
          Returns the updateTime attribute.
 int getVideoDuration()
          Returns the videoDuration attribute.
 int getWidth()
          Returns the width attribute.
 void importData(byte[][] ctx)
          Imports data from an external source into the database BLOB specified by the localData attribute.
 void importFrom(byte[][] ctx, java.lang.String srcType, java.lang.String srcLocation, java.lang.String srcName)
          Imports data from an external source into the database BLOB specified by the localData attribute.
 boolean isLocal()
          Indicates if the video data is stored locally in the database in a BLOB specified by the localData attribute.
 boolean loadDataFromByteArray(byte[] byteArr)
          Loads data from a byte array into the database BLOB specified by the localData attribute.
 boolean loadDataFromFile(java.lang.String filename)
          Loads data from a file into the database BLOB specified by the localData attribute.
 boolean loadDataFromInputStream(java.io.InputStream inpStream)
          Loads data from an InputStream into the database BLOB specified by the localData attribute.
 int openSource(byte[] userarg, byte[][] ctx)
          Opens a data source.
 byte[] processSourceCommand(byte[][] ctx, java.lang.String cmd, java.lang.String args, byte[][] result)
          Calls the source plug-in in the database to execute a command.
 byte[] processVideoCommand(byte[][] ctx, java.lang.String cmd, java.lang.String args, byte[][] result)
          Calls the format plug-in in the database to execute a command.
 int readFromSource(byte[][] ctx, int startpos, int numbytes, byte[][] buffer)
          Reads data from the data source.
 void setBitRate(int bitRate)
          Sets the bitRate attribute.
 void setComments(oracle.sql.CLOB comments)
          Sets the comments attribute.
 void setCompressionType(java.lang.String compressionType)
          Sets the compressionType attribute.
 void setDescription(java.lang.String description)
          Sets the description attribute.
 void setFormat(java.lang.String format)
          Sets the format attribute.
 void setFrameRate(int frameRate)
          Sets the frameRate attribute.
 void setFrameResolution(int frameResolution)
          Sets the frameResolution attribute.
 void setHeight(int height)
          Sets the height attribute.
 void setKnownAttributes(java.lang.String format, int width, int height, int frameResolution, int frameRate, int videoDuration, int numberOfFrames, java.lang.String compressionType, int numberOfColors, int bitRate)
          Sets the known attributes of the OrdVideo Java object.
 void setLocal()
          Sets the local attribute to indicate that the video data is stored locally in the database in a BLOB specified by the localData attribute.
 void setMimeType(java.lang.String mimeType)
          Sets the mimeType attribute.
 void setNumberOfColors(int numberOfColors)
          Sets the numberOfColors attribute.
 void setNumberOfFrames(int numberOfFrames)
          Sets the numberOfFrames attribute.
 void setProperties(byte[][] ctx)
          Parses the video data properties and sets the attributes in the OrdVideo Java object.
 void setProperties(byte[][] ctx, boolean setComments)
          Parses the video data properties, sets the attributes in the OrdVideo Java object, and optionally populates the CLOB specified by the comments attribute.
 void setSource(java.lang.String srcType, java.lang.String srcLocation, java.lang.String srcName)
          Sets the srcType, srcLocation, and srcName attributes.
 void setUpdateTime(java.sql.Timestamp currentTime)
          Sets the updateTime attribute.
 void setVideoDuration(int videoDuration)
          Sets the videoDuration attribute.
 void setWidth(int width)
          Sets the width attribute.
 int trimSource(byte[][] ctx, int newLen)
          Trims the data to the specified length.
 int writeToSource(byte[][] ctx, int startpos, int numbytes, byte[] buffer)
          Writes data to the data source.

 

Methods inherited from class oracle.ord.im.OrdVideoBase
toDatum

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

OrdVideo

public OrdVideo()
Internal constructor used only by the Oracle CustomDatum interface factory method to create an instance of the class. Applications should not use this constructor.
Method Detail

isLocal

public boolean isLocal()
                throws java.sql.SQLException
Indicates if the video data is stored locally in the database in a BLOB specified by the localData attribute.
Returns:
true if the data is stored locally in the database in a BLOB, false otherwise.
Throws:
java.sql.SQLException - if an error occurs accessing the local attribute.

setLocal

public void setLocal()
              throws java.sql.SQLException
Sets the local attribute to indicate that the video data is stored locally in the database in a BLOB specified by the localData attribute.
Throws:
java.sql.SQLException - if an error occurs accessing the local attribute.

clearLocal

public void clearLocal()
                throws java.sql.SQLException
Clears the local attribute to indicate that the video data is stored externally.
Throws:
java.sql.SQLException - if an error occurs accessing the local attribute.

getSourceType

public java.lang.String getSourceType()
                               throws java.sql.SQLException
Returns the srcType attribute. For example, "FILE" or "HTTP".
Returns:
the srcType attribute as a String.
Throws:
java.sql.SQLException - if an error occurs accessing the srcType attribute.

getSourceLocation

public java.lang.String getSourceLocation()
                                   throws java.sql.SQLException
Returns the srcLocation attribute. For example, VIDEOS_DIR or www.xyzcovideos.com/movies.
Returns:
the srcLocation attribute as a String.
Throws:
java.sql.SQLException - if an error occurs accessing the srcLocation attribute.

getSourceName

public java.lang.String getSourceName()
                               throws java.sql.SQLException
Returns the srcName attribute. For example, movie1.mov.
Returns:
the srcName attribute as a String.
Throws:
java.sql.SQLException - if an error occurs accessing the srcName attribute.

getSource

public java.lang.String getSource()
                           throws java.sql.SQLException
Returns the source information in the form srcType://srcLocation/srcName.
Returns:
the source information as a String.
Throws:
java.sql.SQLException - if an error occurs executing the correspoding getSource method in the database.

setSource

public void setSource(java.lang.String srcType,
                      java.lang.String srcLocation,
                      java.lang.String srcName)
               throws java.sql.SQLException
Sets the srcType, srcLocation, and srcName attributes.
Parameters:
srcType - the source type, for example, "FILE", "HTTP".
srcLocation - the source location, for example, VIDEOS_DIR, www.xyzcovideos.com/movies.
srcName - the source name, for example, movie1.mov
Throws:
java.sql.SQLException - if an error occurs accessing the srcType, srcLocation, or srcName attributes.

getUpdateTime

public java.sql.Timestamp getUpdateTime()
                                 throws java.sql.SQLException
Returns the updateTime attribute.
Returns:
the lastUpdate attribute as a java.sql.Timestamp.
Throws:
java.sql.SQLException - if an error occurs accessing the updateTime attribute.

setUpdateTime

public void setUpdateTime(java.sql.Timestamp currentTime)
                   throws java.sql.SQLException
Sets the updateTime attribute. This method sets 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 in a java.sql.Timestamp, or null to set the update time to the database server's current SYSDATE time.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding setUpdateTime method in the database.

getContent

public oracle.sql.BLOB getContent()
                           throws java.sql.SQLException
Returns the BLOB locator from the localData attribute.
Returns:
an oracle.sql.BLOB.
Throws:
java.sql.SQLException - if an error occurs accessing the localData attribute.

getBFILE

public oracle.sql.BFILE getBFILE()
                          throws java.sql.SQLException
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.
Returns:
an oracle.sql.BFILE.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding getBFILE method in the database.

getContentLength

public int getContentLength()
                     throws java.sql.SQLException
Returns the length of the video data. This method calls the corresponding getContentLength method in the database.
Note
This method is not supported for all source types. For example, the "HTTP" source type does not support this method.
Returns:
the content length as an int.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding getContentLength method in the database.

getContentLength

public int getContentLength(byte[][] ctx)
                     throws java.sql.SQLException
Returns the length of the video data using source plug-in context information. This method calls the corresponding getContentLength method in the database.
Note
This method is not supported for all source types. For example, the "HTTP" source type does not support this method.
Parameters:
ctx - the source plug-in context information.
Returns:
the content length as an int.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding getContentLength method in the database.

getDescription

public java.lang.String getDescription()
                                throws java.sql.SQLException
Returns the description attribute.
Returns:
the description attribute as a String.
Throws:
java.sql.SQLException - if an error occurs accessing the description attribute.

setDescription

public void setDescription(java.lang.String description)
                    throws java.sql.SQLException
Sets the description attribute.
Parameters:
description - the new attribute value.
Throws:
java.sql.SQLException - if an error occurs accessing the description attribute.

getFormat

public java.lang.String getFormat()
                           throws java.sql.SQLException
Returns the format attribute.
Returns:
the format attribute as a String.
Throws:
java.sql.SQLException - if an error occurs accessing the format attribute.

setFormat

public void setFormat(java.lang.String format)
               throws java.sql.SQLException
Sets the format attribute.
Note
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 format attribute. Note that calling the setFormat method sets the attribute value only; it does not modify the video data itself.
Parameters:
format - the new attribute value.
Throws:
java.sql.SQLException - if an error occurs accessing the format attribute.

getMimeType

public java.lang.String getMimeType()
                             throws java.sql.SQLException
Returns the mimeType attribute.
Returns:
the mimeType attribute as a String.
Throws:
java.sql.SQLException - if an error occurs accessing the mimeType attribute.

setMimeType

public void setMimeType(java.lang.String mimeType)
                 throws java.sql.SQLException
Sets the mimeType attribute.
Note
setProperties sets this attribute automatically for certain video formats; use this method only if you are not using setProperties. This method sets the attribute value only; it does not modify the video data itself.
Parameters:
mimeType - the new attribute value.
Throws:
java.sql.SQLException - if an error occurs accessing the mimeType attribute.

getComments

public oracle.sql.CLOB getComments()
                            throws java.sql.SQLException
Returns the CLOB locator from the comments attribute.
Returns:
the comments attribute as an oracle.sql.CLOB.
Throws:
java.sql.SQLException - if an error occurs accessing the comments attribute.

setComments

public void setComments(oracle.sql.CLOB comments)
                 throws java.sql.SQLException
Sets the comments attribute.
Note
The comments attribute is reserved for use by interMedia. You can set your own value, but it could be overwritten by interMedia Annotator or by the setProperties method.
Parameters:
comments - the new attribute value.
Throws:
java.sql.SQLException - if an error occurs accessing the comments attribute.

getWidth

public int getWidth()
             throws java.sql.SQLException
Returns the width attribute.
Returns:
the width attribute as an int.
Throws:
java.sql.SQLException - if an error occurs accessing the width attribute.

setWidth

public void setWidth(int width)
              throws java.sql.SQLException
Sets the width attribute.
Note
setProperties sets this attribute automatically for certain video formats; use this method only if you are not using setProperties. This method sets the attribute value only; it does not modify the video data itself.
Parameters:
width - the new attribute value.
Throws:
java.sql.SQLException - if an error occurs accessing the width attribute.

getHeight

public int getHeight()
              throws java.sql.SQLException
Returns the height attribute.
Returns:
the height attribute as an int.
Throws:
java.sql.SQLException - if an error occurs accessing the height attribute.

setHeight

public void setHeight(int height)
               throws java.sql.SQLException
Sets the height attribute.
Note
setProperties sets this attribute automatically for certain video formats; use this method only if you are not using setProperties. This method sets the attribute value only; it does not modify the video data itself.
Parameters:
height - the new attribute value.
Throws:
java.sql.SQLException - if an error occurs accessing the height attribute.

getFrameResolution

public int getFrameResolution()
                       throws java.sql.SQLException
Returns the frameResolution attribute.
Returns:
the frameResolution attribute as an int.
Throws:
java.sql.SQLException - if an error occurs accessing the frameResolution attribute.

setFrameResolution

public void setFrameResolution(int frameResolution)
                        throws java.sql.SQLException
Sets the frameResolution attribute.
Note
setProperties sets this attribute automatically for certain video formats; use this method only if you are not using setProperties. This method sets the attribute value only; it does not modify the video data itself.
Parameters:
frameResolution - the new attribute value.
Throws:
java.sql.SQLException - if an error occurs accessing the frameResolution attribute.

getFrameRate

public int getFrameRate()
                 throws java.sql.SQLException
Returns the frameRate attribute.
Returns:
the frameRate attribute as an int.
Throws:
java.sql.SQLException - if an error occurs accessing the frameRate attribute.

setFrameRate

public void setFrameRate(int frameRate)
                  throws java.sql.SQLException
Sets the frameRate attribute.
Note
setProperties sets this attribute automatically for certain video formats; use this method only if you are not using setProperties. This method sets the attribute value only; it does not modify the video data itself.
Parameters:
frameRate - the new attribute value.
Throws:
java.sql.SQLException - if an error occurs accessing the frameRate attribute.

getVideoDuration

public int getVideoDuration()
                     throws java.sql.SQLException
Returns the videoDuration attribute.
Returns:
the videoDuration attribute as an int.
Throws:
java.sql.SQLException - if an error occurs accessing the videoDuration attribute.

setVideoDuration

public void setVideoDuration(int videoDuration)
                      throws java.sql.SQLException
Sets the videoDuration attribute.
Note
setProperties sets this attribute automatically for certain video formats; use this method only if you are not using setProperties. This method sets the attribute value only; it does not modify the video data itself.
Parameters:
videoDuration - the new attribute value.
Throws:
java.sql.SQLException - if an error occurs accessing the videoDuration attribute.

getNumberOfFrames

public int getNumberOfFrames()
                      throws java.sql.SQLException
Returns the numberOfFrames attribute.
Returns:
the numberOfFrames attribute as an int.
Throws:
java.sql.SQLException - if an error occurs accessing the numberOfFrames attribute.

setNumberOfFrames

public void setNumberOfFrames(int numberOfFrames)
                       throws java.sql.SQLException
Sets the numberOfFrames attribute.
Note
setProperties sets this attribute automatically for certain video formats; use this method only if you are not using setProperties. This method sets the attribute value only; it does not modify the video data itself.
Parameters:
numberOfFrames - the new attribute value.
Throws:
java.sql.SQLException - if an error occurs accessing the numberOfFrames attribute.

getCompressionType

public java.lang.String getCompressionType()
                                    throws java.sql.SQLException
Returns the compressionType attribute.
Returns:
the compressionType attribute as a String.
Throws:
java.sql.SQLException - if an error occurs accessing the compressionType attribute.

setCompressionType

public void setCompressionType(java.lang.String compressionType)
                        throws java.sql.SQLException
Sets the compressionType attribute.
Note
setProperties sets this attribute automatically for certain video formats; use this method only if you are not using setProperties. This method sets the attribute value only; it does not modify the video data itself.
Parameters:
compressionType - the new attribute value.
Throws:
java.sql.SQLException - if an error occurs accessing the compressionType attribute.

getNumberOfColors

public int getNumberOfColors()
                      throws java.sql.SQLException
Returns the numberOfColors attribute.
Returns:
the numberOfColors attribute as an int.
Throws:
java.sql.SQLException - if an error occurs accessing the numberOfColors attribute.

setNumberOfColors

public void setNumberOfColors(int numberOfColors)
                       throws java.sql.SQLException
Sets the numberOfColors attribute.
Note
setProperties sets this attribute automatically for certain video formats; use this method only if you are not using setProperties. This method sets the attribute value only; it does not modify the video data itself.
Parameters:
numberOfColors - the new attribute value.
Throws:
java.sql.SQLException - if an error occurs accessing the numberOfColors attribute.

getBitRate

public int getBitRate()
               throws java.sql.SQLException
Returns the bitRate attribute.
Returns:
the bitRate attribute as an int.
Throws:
java.sql.SQLException - if an error occurs accessing the bitRate attribute.

setBitRate

public void setBitRate(int bitRate)
                throws java.sql.SQLException
Sets the bitRate attribute.
Note
setProperties sets this attribute automatically for certain video formats; use this method only if you are not using setProperties. This method sets the attribute value only; it does not modify the video data itself.
Parameters:
bitRate - the new attribute value.
Throws:
java.sql.SQLException - if an error occurs accessing the bitRate attribute.

loadDataFromFile

public boolean loadDataFromFile(java.lang.String filename)
                         throws java.sql.SQLException,
                                java.io.IOException
Loads data from a file into the database BLOB specified by the localData attribute. Before loading the data, this method calls the following methods:
Parameters:
filename - name of the file from which to load data.
Returns:
true if the data is loaded successfully; otherwise, an exception is raised if an error occurs. This method never returns false.
Throws:
java.sql.SQLException - if an error occurs accessing an object attribute or if an error occurs executing a method in the database.
java.io.IOException - if an error occurs reading the data file.

loadDataFromInputStream

public boolean loadDataFromInputStream(java.io.InputStream inpStream)
                                throws java.sql.SQLException,
                                       java.io.IOException
Loads data from an InputStream into the database BLOB specified by the localData attribute. Before loading the data, this method calls the following methods:
Parameters:
inpStream - the InputStream from which to load data.
Returns:
true if the data is loaded successfully; otherwise, an exception is raised if an error occurs. This method never returns false.
Throws:
java.sql.SQLException - if an error occurs accessing an object attribute or if an error occurs executing a method in the database.
java.io.IOException - if an error occurs reading the InputStream.

loadDataFromByteArray

public boolean loadDataFromByteArray(byte[] byteArr)
                              throws java.sql.SQLException,
                                     java.io.IOException
Loads data from a byte array into the database BLOB specified by the localData attribute. Before loading the data, this method calls the following methods:
Parameters:
byteArr - a byte[] arrary from which to load data.
Returns:
true if the data is loaded successfully; otherwise, an exception is raised if an error occurs. This method never returns false.
Throws:
java.sql.SQLException - if an error occurs accessing an object attribute or if an error occurs executing a method in the database.
java.io.IOException - if an error occurs reading the byte array.

getDataInFile

public boolean getDataInFile(java.lang.String filename)
                      throws java.sql.SQLException,
                             java.io.IOException
Writes the data from the database BLOB specified by the localData attribute to a local file.
Parameters:
filename - name of the file to which the data is to be written.
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.
Throws:
java.sql.SQLException - if an error occurs accessing an object attribute.
java.io.IOException - if an error occurs reading the data from the BLOB or writing the data to the output file.

getDataInStream

public java.io.InputStream getDataInStream()
                                    throws java.sql.SQLException
Returns an InputStream from which the data in the database BLOB specified by the localData attribute can be read.
Returns:
an InputStream from which the data can be read.
Throws:
java.sql.SQLException - if an error occurs accessing an object attribute.

getDataInByteArray

public byte[] getDataInByteArray()
                          throws java.sql.SQLException,
                                 java.io.IOException,
                                 java.lang.OutOfMemoryError
Returns a byte array containing the data from the database BLOB specified by the localData attribute.
Returns:
a byte[] array containng the data.
Throws:
java.sql.SQLException - if an error occurs accessing an object attribute.
java.io.IOException - if an error occurs reading the data from the BLOB.
java.lang.OutOfMemoryError - if sufficient memory cannot be allocated to hold the data.

getContentInLob

public oracle.sql.BLOB getContentInLob(byte[][] ctx,
                                       java.lang.String[] mimetype,
                                       java.lang.String[] format)
                                throws java.sql.SQLException
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.
Important
The application must free the temporary BLOB after accessing the data contained therein.
Parameters:
ctx - the format 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.
Returns:
the video data in a temporary oracle.sql.BLOB.
Throws:
java.sql.SQLException - if an error occurs creating the temporary BLOB or executing the corresponding getContentInLob method in the database.

deleteContent

public void deleteContent()
                   throws java.sql.SQLException
Deletes any data stored in the database BLOB specified by the localData attribute.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding deleteContent method in the database.

importData

public void importData(byte[][] ctx)
                throws java.sql.SQLException
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.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding import method in the database.

importFrom

public void importFrom(byte[][] ctx,
                       java.lang.String srcType,
                       java.lang.String srcLocation,
                       java.lang.String srcName)
                throws java.sql.SQLException
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.
srcType - the source type, for example, "FILE", "HTTP".
srcLocation - the source location, for example, VIDEOS_DIR, www.xyzcovideos.com/movies.
srcName - the source name, for example, movie1.mov.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding importFrom method in the database.

export

public void export(byte[][] ctx,
                   java.lang.String srcType,
                   java.lang.String srcLocation,
                   java.lang.String srcName)
            throws java.sql.SQLException
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 the export method. For example, the "FILE" source type is the only Oracle-supplied source type that supports the export method. In addition, this method is supported only by Oracle database server release 8.1.7 or later.

The remainder of this description illustrates the use of the export method and the Oracle-supplied "FILE" source plug-in. User-written plug-ins will have different behaviors.

The export method implemented by the Oracle-supplied "FILE" source plug-in copies the video data from the BLOB specified by the localData attribute, but does not modify the video data stored in the database BLOB in any way.

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 privilege 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 illustrates 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 "/*" (where "/" is the operating-system dependent file separator character) indicates all the files contained in the specified directory. A path specification that ends with "/-" indicates all files contained in the specified directory and all its subdirectories. A pathname consisting of the special token "<<ALL FILES>>" authorizes access to any file.

See the security and performance section in Oracle Java Developer's Guide and the java.io.FilePermission class in the Java API for more information.

Parameters:
ctx - the source plug-in context information.
srcType - the source type, for example, "FILE".
srcLocation - the source location, for example, VIDEOS_DIR.
srcName - the source name, for example, movie1.mov.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding export method in the database.

setProperties

public void setProperties(byte[][] ctx)
                   throws java.sql.SQLException
Parses the video data properties and sets the attributes in the OrdVideo Java object. This method sets 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 if the video format is not recognized.
Note
The format attribute determines which format plug-in is used to parse the video data properties. If the format attribute is null when setProperties 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 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 setProperties is called.
Parameters:
ctx - the format plug-in context information.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding setProperties method in the database.

setProperties

public void setProperties(byte[][] ctx,
                          boolean setComments)
                   throws java.sql.SQLException
Parses the video data properties, sets the attributes in the OrdVideo Java object, and optionally populates the CLOB specified by the comments attribute. This method sets 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 setComments is true, this method also populates the CLOB specified by the comments attribute with all extracted properties in XML form. If setComments is false, the comments attribute is not modified. This method throws a SQLException if the video format is not recognized.
Note
The format attribute determines which format plug-in is used to parse the video data properties. If the format attribute is null when setProperties 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 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 setProperties is called.
Parameters:
ctx - the format plug-in context information.
setComments - a boolean that specifies whether or not to populate the CLOB specified by the comments attribute.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding setProperties method in the database.

checkProperties

public boolean checkProperties(byte[][] ctx)
                        throws java.sql.SQLException
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.
Returns:
true if the properties of the video data are consistent with the attributes of the OrdVideo Java object; false otherwise.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding checkProperties method in the database.

getAttribute

public java.lang.String getAttribute(byte[][] ctx,
                                     java.lang.String name)
                              throws java.sql.SQLException
Returns the value of the requested video property. This method is used by user-defined format plug-ins to return the value of an 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.
Returns:
the attribute value as a String.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding getAttribute method in the database.

getAllAttributes

public oracle.sql.CLOB getAllAttributes(byte[][] ctx)
                                 throws java.sql.SQLException
Returns 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.
Important
The application must free the temporary CLOB after reading the information contained therein.

Parameters:
ctx - the format plug-in context information.
Returns:
the attributes as a temporary oracle.sql.CLOB.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding getAllAttributes method in the database.

setKnownAttributes

public void setKnownAttributes(java.lang.String format,
                               int width,
                               int height,
                               int frameResolution,
                               int frameRate,
                               int videoDuration,
                               int numberOfFrames,
                               java.lang.String compressionType,
                               int numberOfColors,
                               int bitRate)
                        throws java.sql.SQLException
Sets the known attributes of the OrdVideo Java object.
Note
setProperties sets 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 setProperties. This method sets the specified attribute values only; it does not modify the video data itself.
Parameters:
format - the new attribute value as a String.
width - the new attribute value as an int.
height - the new attribute value as an int.
frameResolution - the new attribute value as an int.
frameRate - the new attribute value as an int.
videoDuration - the new attribute value as an int.
numberOfFrames - the new attribute value as an int.
compressionType - the new attribute value as a String.
numberOfColors - the new attribute value as an int.
bitRate - the new attribute value as an int.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding setKnownAttributes method in the database.

processVideoCommand

public byte[] processVideoCommand(byte[][] ctx,
                                  java.lang.String cmd,
                                  java.lang.String args,
                                  byte[][] result)
                           throws java.sql.SQLException
Calls the format plug-in in the database to execute a command. This method is for use 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.
Returns:
the result of the command execution
Throws:
java.sql.SQLException - if an error occurs executing the corresponding processVideoCommand method in the database.

openSource

public int openSource(byte[] userarg,
                      byte[][] ctx)
               throws java.sql.SQLException
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.
Returns:
the status as an int, where 0 indicates success and a non-0 value indicates a failure code specific to the source plug-in.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding openSource method in the database.

closeSource

public int closeSource(byte[][] ctx)
                throws java.sql.SQLException
Closes a data source.
Parameters:
ctx - the source plug-in context information.
Returns:
the status as an int, where 0 indicates success and a non-0 value indicates a failure code specific to the source plug-in.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding closeSource method in the database.

readFromSource

public int readFromSource(byte[][] ctx,
                          int startpos,
                          int numbytes,
                          byte[][] buffer)
                   throws java.sql.SQLException
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, if you call the openSource method before calling readFromSource, your application should work with any current or future source plug-ins.

Parameters:
ctx - the source plug-in context information.
startpos - the start position in the data source.
numbytes - the number of bytes to read from the data source.
buffer - a byte[][] array of the form [1][n], where n >= numbytes
Returns:
number of bytes read as an int.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding readFromSource method in the database.

writeToSource

public int writeToSource(byte[][] ctx,
                         int startpos,
                         int numbytes,
                         byte[] buffer)
                  throws java.sql.SQLException
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" source types do not support writable data sources 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, if you call the openSource method before calling writeToSource, your application should work with any current or future source plug-ins.

Parameters:
ctx - the source plug-in context information.
startpos - the start position in the data source.
numbytes - the number of bytes to write to the data source.
buffer - a byte[] array containing the data to be written.
Returns:
number of bytes written as an int.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding writeToSource method in the database.

trimSource

public int trimSource(byte[][] ctx,
                      int newLen)
               throws java.sql.SQLException
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" source types do not support writable data sources 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, if you call the openSource method before calling trimSource, your application should work with any current or future source plug-ins.

Parameters:
ctx - the source plug-in context information.
Returns:
the status as an int, where 0 indicates success and a non-0 value indicates a failure code specific to the source plug-in.
Throws:
java.sql.SQLException - if an error occurs executing the corresponding trimSource method in the database.

processSourceCommand

public byte[] processSourceCommand(byte[][] ctx,
                                   java.lang.String cmd,
                                   java.lang.String args,
                                   byte[][] result)
                            throws java.sql.SQLException
Calls the source plug-in in the database to execute a command. This method is for use 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.
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.
Returns:
the result of the command execution
Throws:
java.sql.SQLException - if an error occurs executing the corresponding processSourceCommand method in the database.

getFactory

public static oracle.sql.CustomDatumFactory getFactory()
Returns the OrdVideo CustomDatumFactory for use by the getCustomDatum method. Specify this method as the factory parameter of the getCustomDatum method when retrieving an OrdVideo object from an OracleResultSet or OracleCallableStatement. For example:
  OrdVideo vid = (OrdVideo)rset.getCustomDatum( 1, OrdVideo.getFactory() );
Returns:
the OrdVideo implementation of the CustomDatumFactory interface.

create

public oracle.sql.CustomDatum create(oracle.sql.Datum d,
                                     int sqlType)
                              throws java.sql.SQLException
Internal method used only by the Oracle CustomDatum interface. Applications should not call this method.
Specified by:
create in interface oracle.sql.CustomDatumFactory
Overrides:
create in class oracle.ord.im.OrdVideoBase
java.sql.SQLException

Oracle9i Business Components for Java InterMedia API Reference
Oracle9i JDeveloper (9.0.4)
B10394-01

Copyright © 2001,2003, Oracle. All Rights Reserved.