The varying-length-data stream
The varying-length-data stream provides access to the data within
a varying-length structure (mi_lvarchar) through
the stream I/O interface. A varying-length-data stream does not handle
varying-length data as null-terminated strings. It also does not evaluate
the contents of the data stream in any way. To support a data stream
on a varying-length structure, the DataBlade
API provides the stream I/O
functions in Table 1.
Stream I/O Task | Stream I/O Function |
---|---|
Initialize and open a varying-length-data stream. | mi_stream_open_mi_lvarchar() |
Move the stream seek position to the desired location. | mi_stream_seek() |
Read a specified number of bytes from the varying-length-data stream. | mi_stream_read() |
Write a specified number of bytes to the varying-length-data stream. | mi_stream_write() |
Obtain the current stream seek position, returning it from the function. | mi_stream_tell() |
Obtain the current stream seek position, returning it in a function parameter. | mi_stream_getpos() |
Set the stream seek position. | mi_stream_setpos() |
Obtain the length of the varying-length data. | mi_stream_length() |
Close the varying-length-data stream. | mi_stream_close() |
Tip: You can also use the mi_stream_get_error() and mi_stream_eof() functions
on a varying-length-data stream.
As Table 1 shows, the stream I/O interface for a varying-length-data stream consists of the generic stream I/O functions plus a type-specific stream-open function, mi_stream_open_mi_lvarchar(). This function returns a new varying-length-data stream.