Orastream APIs support handling of of text and binary nodes that exceed 64K in an XML document.
Orastream contains the following group of interfaces:
The datatypes used by Orastream are found in Chapter 1, "Datatypes for C"; they include oracheck, oraerr, oraprop_id, oramemctx, oraprop, oraprop_t, oraprop_v, orastream, and orastreamhdl.
The error codes for the Orastream interfaces are described in Table 5-1.
Table 5-1 Orastream Error Codes
Error Code | Description |
---|---|
|
Null pointer encountered. |
|
Invalid stream object. |
|
Stream object is defined for the opposite I/O direction. |
|
Unknown creation property. |
|
The I/O direction of the stream is undefined. |
|
The stream direction is incorrectly defined as using both I/O directions. |
|
The stream is not open. |
|
The stream is defined for the opposite char/byte mode. |
|
The stream cannot be opened. |
|
The stream cannot be closed. |
For more information on Orastream interfaces, see Oracle XML Developer's Kit Programmer's Guide.
These methods support unidirectional streams used to move data piecewise. The direction and mode of the stream is determined by the paramters that initialize the stream in the OraStreamInit() method.
Table 5-2 Summary of OraStream Methods; Package Orastream
Function | Summary |
---|---|
Closes the stream. |
|
Returns the handle to the stream. |
|
Initializes the stream. |
|
Determines if the stream is open. |
|
Opens the stream. |
|
Reads bytes from the stream. |
|
Determines if the stream is readable. |
|
Reads characters from the stream. |
|
Sets the SID of a stream. |
|
Destroys the stream. |
|
Writes bytes to the stream. |
|
Determines if the stream is writable. |
|
Writes characters to the stream. |
Closes the orastream
object.
The function is used to close the given stream by calling the 'close' callback function of the stream.
Returns ORAERR_OK
for success, or the error code for failure. See Table 5-1.
oraerr OraStreamClose( orastream *stream);
Parameter | In/Out | Description |
---|---|---|
stream |
IN |
Stream that is closed |
Returns the handle of the orastream
object.
The handle contains the generic pointers and file descriptors.
orastreamhdl *OraStreamHandle( orastream *stream);
Parameter | In/Out | Description |
---|---|---|
stream |
IN |
Stream whose handle is returned |
Creates and initializes a orastream
object.
orastream *OraStreamInit(
void *sctx,
void *sid,
oraerr *err,
list);
Parameter | In/Out | Description |
---|---|---|
sctx |
IN |
The input context; may be NULL |
sid |
IN |
The user-defined stream context identifier |
err |
OUT |
The error, if any. ORAERR_OK for success, or the error code for failure. See Table 5-1 |
list
|
IN |
NULL -terminated list of name-value pairs of arguments that specify the properties of the new orastream oject. These are:
|
Determines if the orastream
is open. Returns TRUE
or FALSE
.
Note that the stream must be open to perform read and write operations.
boolean OraStreamIsOpen( orastream *stream);
Parameter | In/Out | Description |
---|---|---|
stream |
IN |
The stream that should be open for reads or writes. |
Opens the orastream
object.
The function opens the stream by calling the 'open' callback function of the stream.
Returns ORAERR_OK
for success, or the error code for failure. See Table 5-1.
oraerr OraStreamOpen( orastream *stream, ubig_ora *length)
Parameter | In/Out | Description |
---|---|---|
stream |
IN |
The stream that is open |
length |
OUT |
Optional parameter; not used |
Reads byte
s from the orastream
object.
The function is used to read the data from the stream into the specified buffer. It also returns TRUE
for the eoi
parameter if the end of stream is reached.
Returns ORAERR_OK
for success, or the error code for failure. See Table 5-1.
oraerr OraStreamRead( orastream *stream, oratext *dest, ubig_ora size, oratext **start, ubig_ora *nread, ub1 *eoi);
Parameter | In/Out | Description |
---|---|---|
stream |
IN |
Stream that is being read |
dest |
IN |
The destination buffer |
size |
IN |
The size of the data to be read |
start |
OUT |
Pointer to the start of data being read |
nread |
OUT |
Number of bytes actually read from the stream |
eoi |
OUT |
Returns TRUE if end of the stream is reached; FALSE otherwise |
Determines if an existing orastream
object is readable.
Returns TRUE
or FALSE
.
boolean OraStreamReadable( orastream *stream);
Parameter | In/Out | Description |
---|---|---|
stream |
IN |
Stream that is checked for readability |
Reads char
s from the orastream
object.
The function is used to read the data from the stream into the specified buffer. It also returns TRUE
for the eoi
parameter if the end of stream is reached.
Returns ORAERR_OK
for success, or the error code for failure. See Table 5-1.
oraerr OraStreamReadChar( orastream *stream, oratext *dest, ubig_ora size, oratext **start, ubig_ora *nread, ub1 *eoi);
Parameter | In/Out | Description |
---|---|---|
stream |
IN |
Stream that is being read |
dest |
IN |
The destination buffer |
size |
IN |
The size of the data to be read |
start |
OUT |
Pointer to the start of data being read |
nread |
OUT |
Number of characters actually read from the stream |
eoi |
OUT |
Returns TRUE if end of the stream is reached; FALSE otherwise |
Assigns an SID to an existing orastream
object. Returns the old SID through the OUT
parameter osid
.
Returns ORAERR_OK
for success, or the error code for failure. See Table 5-1.
oraerr OraStreamSid( orastream *stream, void *sid, void **osid);
Parameter | In/Out | Description |
---|---|---|
stream |
IN |
The stream whose SID is changed |
sid |
IN |
The new SID |
osid |
OUT |
The previous SID of the stream |
Destroys a orastream
object and frees its associated memory.
Returns ORAERR_OK
for success, or the error code for failure. See Table 5-1.
oraerr OraStreamTerm( orastream *stream);
Parameter | In/Out | Description |
---|---|---|
stream |
IN |
Stream that is destroyed |
Writes byte
s to the orastream
object.
The number of bytes actually read are stored by the OUT
parameter nwrote
.
Returns ORAERR_OK
for success, or the error code for failure. See Table 5-1.
oraerr OraStreamWrite( orastream *stream, oratext *src, ubig_ora size, ubig_ora *nwrote);
Parameter | In/Out | Description |
---|---|---|
stream |
IN |
Stream where the data is written |
src |
IN |
Buffer from which the data is written |
size |
IN |
Size of data to be written |
nwrote |
OUT |
Number of bytes written to the stream |
Determines if an existing orastream
object is writable.
Returns TRUE
or FALSE
.
boolean OraStreamWritable( orastream *stream);
Parameter | In/Out | Description |
---|---|---|
stream |
IN |
Stream that is checked for writability. |
Writes char
s to the orastream
object.
The number of characters actually written are stored by the OUT
parameter nwrote
.
Returns ORAERR_OK
for success, or the error code for failure. See Table 5-1.
oraerr OraStreamWriteChar( orastream *stream, oratext *src, ubig_ora size, ubig_ora *nwrote);
Parameter | In/Out | Description |
---|---|---|
stream |
IN |
Stream where the data is written |
src |
IN |
Buffer from which the data is written |
size |
IN |
Size of data to be written |
nwrote |
OUT |
Number of characters written to the stream |