InputBuffer

class vertica_sdk.InputBuffer(inputstate)

Interface for reading a raw data stream. Objects of this type wrap an in-memory buffer provided by Vertica.

Methods for retrieving data can return either raw data or decoded data. Only one encoding may be specified for the stream. To specify an encoding for the data stream, call setEncoding() before calling any other method of this object.

advance(self, length=None)

Advance the buffer offset by the indicated number of characters. See peek().

Returns the new offset.

getOffset(self)

Return the current position from which data will be read.

getSize(self)

Return the number of characters in the buffer.

peek(self, length=None)

Copy data from the underlying buffer into Python. If no encoding has been specified (via setEncoding()) this returns a bytes object containing raw data. Otherwise, this returns data decoded into an object corresponding to the specified encoding (for example, 'utf-8' would return a string).

If length is None, returns all available data. If length is not None then the length of the returned object is at most what is requested.

This method does not advance the buffer offset.

read(self, length=None)

See peek(). This method does the same thing as peek(), but it also advances the buffer offset by the number of characters consumed.

setEncoding(self, encoding)

Set the encoding of the data contained in the underlying buffer.