[][src]Function ion_c_sys::ion_reader_seek

pub unsafe extern "C" fn ion_reader_seek(
    hreader: hREADER,
    offset: POSITION,
    length: SIZE
) -> iERR

moves the stream position to the specified offset. Resets the the state of the reader to be at the top level. As long as the specified position is at the first byte of a top-level value (just before the type description byte) this will work neatly. Do not attempt to seek to a value below the top level, as the view of the data is likely to be invalid.

If a length is specified (default is -1 or no limit) eof will be returned when length bytes are consumed.

A common pattern when using this interface would be to open the reader from an in memory buffer stream or a seek-able file handle. Then call ion_reader_next which will read the ion version marker and the initial local symbol table (if one is present). At that point the symbol table will be current and later seek's will have an appropriate symbol table to use.