Up: GEOS SDK TechDocs | Up | Prev: SpoolModifyPriority() ... | Next: StreamWrite() ...

StreamOpen()

StreamError	 StreamOpen (
        GeodeHandle 		driver,
        word 		buffSize,
        GeodeHandle		owner,
        HeapFlags 		heapFlags,
        StreamToken *		stream);

This routine opens a stream. It is passed the following:

driver
The GeodeToken of the stream driver.
buffSize
The size of the stream buffer, in bytes.
owner
The geode which will own the stream.
heapFlags
The flags for the creation of the buffer block.
*stream
The stream token will be written here.

If StreamOpen() is successful, it returns zero and writes the stream's token to *stream . If it is unsuccessful, it returns a member of the StreamError enumerated type.

StreamQuery()

StreamError StreamQuery (
        GeodeHandle 		driver,
        StreamToken 		stream,
        StreamRoles 		role,
        word *		bytesAvailable);

This routine finds out either how much free space is available in a stream's buffer, or how much data is waiting to be read. It is passed the following arguments:

driver
The GeodeToken of the stream driver.
stream
The StreamToken of the stream.
role
If this is STREAM_ROLES_WRITER, the routine will return the amount of free space available in the stream buffer. If it is STREAM_ROLES_READER, it will return the amount of data waiting to be read.
*bytesAvailable
The routine will write the number of bytes available (for writing or reading) to this variable.

If the routine is successful, it returns zero. If it is unsuccessful, it returns a member of the StreamError enumerated type.

StreamRead()

StreamError StreamRead (
        GeodeHandle 		driver,
        StreamToken 		stream,
        StreamBlocker 		blocker,
        word 		buffSize,
        byte *		buffer,
        word *		numBytesRead);

This routine reads data from a stream. The routine takes the following arguments:

driver
The GeodeToken of the stream driver.
stream
The StreamToken of the stream.
blocker
Specify whether to block if there is not enough data waiting to be read.
buffsize
Size of passed buffer (i.e. amount of data to read from stream).
buffer
Pointer to buffer where data from stream will be written.
*numBytesReadRead
StreamRead() will write to this variable the number of bytes actually read from the stream.

If StreamRead() is successful, it returns zero. If it is unsuccessful, or could not read all the data requested from the stream, it returns a member of the StreamError enumerated type.

StreamReadByte()

StreamError StreamWriteByte (
        GeodeHandle 		driver,
        StreamToken 		stream,
        StreamBlocker 		blocker,
        byte *		dataByte);

This routine reads a single byte from a stream. It takes the following arguments:

driver
The GeodeToken of the stream driver.
stream
The StreamToken of the stream.
blocker
Specify whether to block if there is not enough room to write the data.
*dataByte
Read a byte from the stream, and write it to this variable.

If the routine is successful, it returns zero. If it is unsuccessful, it returns a member of the StreamError enumerated type.

StreamSetError()

StreamError StreamSetError(
        Handle 		driver,
        StreamToken 		stream,
        StreamRoles 		roles,
        word 		errorCode);

This routine sets the device-specific error code for a stream; this code can later be recovered by StreamGetError() . It takes the following arguments:

driver
The GeodeToken of the stream driver.
stream
The StreamToken of the stream.
role
Either STREAM_ROLES_WRITER or STREAM_ROLES_READER.
errorCode
A 16-bit device-specific error code.

If the routine is successful, it returns zero. If it is unsuccessful, it returns a member of the StreamError enumerated type.


Up: GEOS SDK TechDocs | Up | Prev: SpoolModifyPriority() ... | Next: StreamWrite() ...