Skip Headers


Previous Next

4
OrdDoc Reference Information

The OrdDoc class is used to represent an instance of the ORDSYS.ORDDoc database type in a Java application. The OrdDoc 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 OrdDoc Java object.

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

If your application modifies the OrdDoc Java object, or the media data in the database, you must update the ORDDoc SQL object in the database to make those changes permanent.

Some methods in the OrdDoc 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 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.

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

4.1 Prerequisites

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

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

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

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

4.2 Reference Information

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


clearLocal( )

Format

public void clearLocal( )

Description

Clears the local attribute to indicate that the media 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

docObj.clearLocal( )

closeSource( )

Format

public int closeSource(byte[ ] [ ] ctx)

Description

Closes a data source.

Parameters

ctx

The source plug-in context information.

Return Value

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

Exceptions

java.sql.SQLException

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

Examples

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

where:


deleteContent( )

Format

public void deleteContent( )

Description

Deletes 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

docObj.deleteContent( );

export( )

Format

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

Description

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

Not all source plug-ins support the export 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 Oracle-supplied "file" source plug-in copies, but does not modify, the media data stored in the database BLOB specified by the localData attribute.

After exporting the media data, all the media 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 media data within the database, call the clearLocal( ) method to indicate that the media data is stored outside the database, and call the deleteContent( ) method to delete the media 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 filmclip1.mov:

CALL DBMS_JAVA.GRANT_PERMISSION(
'MEDIAUSER',
'java.io.FilePermission',
'/media/movies/filmclip1.mov',
'write');

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

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

Parameters

ctx

The source plug-in context information.

srcType

The source type to which the content will be exported.

srcLocation

The source location to which the content will be exported.

srcName

The source name to which the content will be exported.

Return Value

None.

Exceptions

java.sql.SQLException

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

Examples

byte [ ] [ ] ctx = new byte[1][64];
docObj.export(ctx,"file","DOCDIR","complete.xml");

where:


getBFILE( )

Format

public oracle.sql.BFILE getBFILE( )

Description

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

Parameters

None.

Return Value

This method returns an oracle.sql.BFILE locator.

Exceptions

java.sql.SQLException

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

Examples

BFILE documentBFILE = docObj.getBFILE( );

getComments( )

Format

public oracle.sql.CLOB getComments( )

Description

Returns the CLOB locator from the comments attribute.

Parameters

None.

Return Value

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

Exceptions

java.sql.SQLException

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

Examples

CLOB comments = docObj.getComments( )

getContent( )

Format

public oracle.sql.BLOB getContent( )

Description

Returns the BLOB locator from the localData attribute.

Parameters

None.

Return Value

This method returns an oracle.sql.BLOB locator.

Exceptions

java.sql.SQLException

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

Examples

BLOB localContent = docObj.getContent( );

getContentInLob( )

Format

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

Description

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


Note:

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

Parameters

ctx

The source plug-in context information.

mimetype

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

format

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

Return Value

This method returns the media 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 = docObj.getContentInLob(ctx,mimetype,format);

where:


getContentLength( )

Format

public int getContentLength( )

Description

Returns the value of the contentLength attribute.

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 accessing the contentLength attribute.

Examples

int contentLength = docObj.getContentLength( );

getDataInByteArray( )

Format

public byte[ ] getDataInByteArray( )

Description

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

Parameters

None.

Return Value

This method returns a byte array containing the data.

Exceptions

java.sql.SQLException

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

java.io.IOException

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

java.lang.OutOfMemoryError

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

Examples

byte[ ] byteArr = docObj.getDataInByteArray( );

getDataInFile( )

Format

public boolean getDataInFile(String filename)

Description

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

Parameters

filename

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

Return Value

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

Exceptions

java.sql.SQLException

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

java.io.IOException

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

Examples

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

where:


getDataInStream( )

Format

public InputStream getDataInStream( )

Description

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

Parameters

None.

Return Value

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

Exceptions

java.sql.SQLException

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

Examples

InputStream inpStream = docObj.getDataInStream( );


getFactory( )

Format

public static oracle.sql.CustomDatumFactory getFactory( )

Description

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

Parameters

None.

Return Value

This method returns the OrdDoc implementation of the CustomDatumFactory interface.

Exceptions

None.

Examples

OrdDoc media = (OrdDoc)rset.getCustomDatum( 1, OrdDoc.getFactory() );

getFormat( )

Format

public String getFormat( )

Description

Returns the value of the format attribute.

Parameters

None.

Return Value

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

Exceptions

java.sql.SQLException

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

Examples

String format = docObj.getFormat( );

getMimeType( )

Format

public String getMimeType( )

Description

Returns the value of the mimeType attribute.

Parameters

None.

Return Value

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

Exceptions

java.sql.SQLException

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

Examples

String mimeType = docObj.getMimeType( );

getSource( )

Format

public String getSource( )

Description

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

Parameters

None.

Return Value

This method returns the source information, as a String.

Exceptions

java.sql.SQLException

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

Examples

String source = docObj.getSource( );

getSourceLocation( )

Format

public String getSourceLocation( )

Description

Returns the value of the srcLocation attribute.

Parameters

None.

Return Value

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

Exceptions

java.sql.SQLException

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

Examples

String location = docObj.getSourceLocation( );

getSourceName( )

Format

public String getSourceName( )

Description

Returns the value of the srcName attribute.

Parameters

None.

Return Value

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

Exceptions

java.sql.SQLException

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

Examples

String name = docObj.getSourceName( );

getSourceType( )

Format

public String getSourceType( )

Description

Returns the value of the srcType attribute.

Parameters

None.

Return Value

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

Exceptions

java.sql.SQLException

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

Examples

String type = docObj.getSourceType( );

getUpdateTime( )

Format

public java.sql.Timestamp getUpdateTime( )

Description

Returns the value of the updateTime attribute.

Parameters

None.

Return Value

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

Exceptions

java.sql.SQLException

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

Examples

Timestamp time = docObj.getUpdateTime( );

importData( )

Format

public void importData(byte[ ] [ ] ctx, boolean setProp)

Description

Imports data from an external source into the database BLOB specified by the localData attribute, and optionally calls the setProperties( ) method. If the setProp parameter is true, this method calls the setProperties( ) method in the database to set the property attributes and populate the CLOB specified by the comments attribute. The external data source is specified by the srcType, srcLocation, and srcName attributes.

Parameters

ctx

The source plug-in context information.

setProp

A Boolean value that specifies whether or not to call the setProperties( ) method.

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];
docObj.importData(ctx);

where:


importFrom( )

Format

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

Description

Imports data from an external source into the database BLOB specified by the localData attribute, and optionally calls the setProperties( ) method. If the setProp parameter is true, this method calls the setProperties( ) method in the database to set the property attributes and populate the CLOB specified by the comments attribute. The external data source is specified by the srcType, srcLocation, and srcName parameters. The srcType, srcLocation, and srcName attributes are updated with values of the srcType, srcLocation, and srcName parameters passed to the importFrom( ) method.

Parameters

ctx

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

srcType

The source type from which the data will be imported.

srcLocation

The source location from which the data will be imported.

srcName

The source name from which the data will be imported.

setProp

A Boolean value that specifies whether or not to call the setProperties( ) method.

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];
docObj.importFrom("file","DOCDIR","testdoc.dat");

where:


isLocal( )

Format

public boolean isLocal( )

Description

Indicates if the media 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(docObj.isLocal( ))
     System.out.println("local attribute is set to true");
else
     System.out.println("local attribute is set to false");

loadDataFromByteArray( )

Format

public boolean loadDataFromByteArray(byte[ ] byteArr)

Description

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

Parameters

byteArr

The name of the local 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("testdoc.dat");
fStream.read(data,0,32000);
boolean success = docObj.loadDataFromByteArray(data);
if(success)
     System.out.println("loadDataFromByteArray was successful");
else
     System.out.println("loadDataFromByteArray was unsuccessful");
 

where:


loadDataFromFile( )

Format

public boolean loadDataFromFile(String filename)

Description

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

Parameters

filename

The name of the local 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

docObj.loadDataFromFile("testdoc.dat");

where:


loadDataFromInputStream( )

Format

public boolean loadDataFromInputStream(InputStream inpStream)

Description

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

Parameters

inpStream

The name of 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("testdoc.dat");
docObj.loadDataFromInputStream(fStream);

where:


openSource( )

Format

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

Description

Opens a data source.

Parameters

userarg

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

ctx

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

Return Value

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

Exceptions

java.lang.Exception

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

Examples

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

where:


processSourceCommand( )

Format

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

Description

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

Parameters

ctx

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

cmd

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

args

The arguments of the command.

result

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

Return Value

This method returns the results of executing the command.

Exceptions

java.sql.SQLException

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

Examples

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

where:


readFromSource( )

Format

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

Description

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

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

Parameters

ctx

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

startpos

The start position in the data source.

numbytes

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

buffer

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

Return Value

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

Exceptions

java.sql.SQLException

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

Examples

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

where:


setComments( )

Format

public void setComments(oracle.sql.CLOB comments)

Description

Sets the value of the comments attribute.

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

Parameters

comments

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

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

Examples

docObj.setComments(commentsData);

where:


setContentLength( )

Format

public void setContentLength(int contentLength)

Description

Sets the value of the contentLength attribute.

The setProperties( ) method sets this attribute automatically for certain media 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 media data itself.

Parameters

contentLength

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

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

Examples

None.


setFormat( )

Format

public void setFormat(String format)

Description

Sets the value of the format attribute.

The format attribute determines which format plug-in is used to handle calls to methods that operate on the media data. In particular, the setProperties( ) method uses the format attribute to determine which format plug-in to call to parse the media 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 this method sets only the attribute value; it does not modify the media data itself.

Parameters

format

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

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

Examples

docObj.setFormat("AUFF");

where:


setLocal( )

Format

public void setLocal( )

Description

Sets the value of the local attribute to indicate that the media 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

docObj.setLocal( );


setMimeType( )

Format

public void setMimeType(String mimeType)

Description

Sets the value of the mimeType attribute.

The setProperties( ) method sets this attribute automatically for certain media 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 media data itself.

Parameters

mimeType

The new attribute value.

Return Value

None.

Exceptions

java.sql.SQLException

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

Examples

docObj.setMimeType("application/pdf");

where:


setProperties( )

Format

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

Description

Parses the media data properties, sets the values of the attributes in the OrdDoc Java object, and optionally populates the CLOB specified by the comments attribute. This method sets the values of the format, mimeType, and contentLength attributes. An attribute is set to null if the corresponding property cannot be extracted for a specific media 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 media format is not recognized.

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

Parameters

ctx

The format plug-in context information.

setComments

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

Return Value

None.

Exceptions

java.sql.SQLException

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

Examples

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

where:


setSource( )

Format

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

Description

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

Parameters

srcType

The type of the source.

srcLocation

The location of the source.

srcName

The name of the source.

Return Value

None.

Exceptions

java.sql.SQLException

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

Examples

docObj.setSource("file","DOCDIR","sample.pdf");

where:


setUpdateTime( )

Format

public void setUpdateTime(java.sql.Timestamp currentTime)

Description

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

Parameters

currentTime

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

Return Value

None.

Exceptions

java.sql.SQLException

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

Examples

docObj.setUpdateTime(null);


trimSource( )

Format

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

Description

Trims the data to the specified length.

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

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

Parameters

ctx

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

newLen

The length to which the data is to be trimmed.

Return Value

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

Exceptions

java.sql.SQLException

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

Examples

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

where:


writeToSource( )

Format

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

Description



Writes data to the data source. This method writes the specified number of bytes from the application buffer to the data source, starting at the specified position in the data source.

Not all source plug-ins support write operations. For example, applications can write to a BLOB specified by the localData attribute; however, the "file" and "http" data source types do not support write access, and so do not support this method. Furthermore, those source plug-ins that do support write access may support only sequential write access, and may not support write access to arbitrary starting positions within the data source.

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

Parameters

ctx

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

startpos

The start position in the data source.

numbytes

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

buffer

A byte array containing the data to be written.

Return Value

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

Exceptions

java.sql.SQLException

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

Examples

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

where:




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

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

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

Master Index

Feedback