Oracle® interMedia Reference 10g Release 1 (10.1) Part Number B10829-01 |
|
|
View PDF |
Format
readFromSource(
ctx IN OUT RAW,
startPos IN INTEGER,
numBytes IN OUT INTEGER,
buffer OUT RAW);
Description
Lets you read a buffer of n bytes from a source beginning at a start position.
Parameters
The source plug-in context information. This should be allocated and initialized to NULL. If you are using a user-defined source plug-in, you should call the openSource( ) method. See the introduction to this chapter for more information.
The start position in the data source.
The number of bytes to be read from the data source.
The buffer into which the data will be read.
Usage Notes
This method is not supported for HTTP sources.
To successfully read HTTP source types, you must request that the entire URL source be read. If you want to implement a read method for an HTTP source type, you must provide your own implementation for this method in the modified source plug-in for the HTTP source type.
Pragmas
None.
Exceptions
ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION
This exception is raised if you call the readFromSource( ) method and the value of the source.srcType attribute is NULL.
ORDSourceExceptions.NULL_SOURCE
This exception is raised if you call the readFromSource( ) method and the value of source.local is 1 or NULL (TRUE), but the value of the source.localData attribute is NULL.
ORDSourceExceptions.METHOD_NOT_SUPPORTED
This exception is raised if you call the readFromSource( ) method and this method is not supported by the source plug-in being used.
ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION
This exception is raised if you call the readFromSource( ) method and the source plug-in raises an exception.
See Appendix F for more information about these exceptions.
Examples
Read a buffer from the source:
DECLARE obj ORDSYS.ORDAudio; buffer RAW(4000); i INTEGER; ctx RAW(64) :=NULL; BEGIN i := 20; SELECT p.product_audio into obj from pm.online_media p WHERE p.product_id = 1733; obj.readFromSource(ctx,1,i,buffer); DBMS_OUTPUT.PUT_LINE('Length is ' || TO_CHAR(obj.getContentLength(ctx))); COMMIT; EXCEPTION WHEN ORDSYS.ORDSourceExceptions.METHOD_NOT_SUPPORTED THEN DBMS_OUTPUT.PUT_LINE('ORDSourceExceptions.METHOD_NOT_SUPPORTED caught'); WHEN ORDSYS.ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION THEN DBMS_OUTPUT.PUT_LINE('ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION caught'); WHEN ORDSYS.ORDSourceExceptions.NULL_SOURCE THEN DBMS_OUTPUT.PUT_LINE('ORDSourceExceptions.NULL_SOURCE caught'); WHEN ORDSYS.ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION THEN DBMS_OUTPUT.PUT_LINE('ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION caught'); WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('EXCEPTION caught'); END; /