CloudEvent

Stream methods - CloudEvent

The CloudEvent class implements the Stream interface which can be helpful if you want to read or write the event data as a stream of bytes.

seek - CloudEvent

Seek to a position relative to the start of the data (0 = first byte).

// PROTOTYPE
int seek(size_t pos)

pos - CloudEvent

Returns the current position in the data.

// PROTOTYPE
size_t pos() const

write - CloudEvent

Write a byte or bytes to the data at the current position.

// PROTOTYPES
size_t write(uint8_t b) override
size_t write(const uint8_t* data, size_t size) override
int write(const char* data)
int write(const char* data, size_t size)

read - CloudEvent

Read a byte or bytes from the data at the current position.

// PROTOTYPES
int read() override
int read(char* data, size_t size)

readBytes - CloudEvent

Read a bytes from the data at the current position.

// PROTOTYPE
size_t readBytes(char* data, size_t size) override

peek - CloudEvent

Read a byte or bytes from the data at the current position but do not move the current position so the next read will read the same bytes.

// PROTOTYPES
int peek() override 
int peek(char* data, size_t size)

available - CloudEvent

Returns the number of bytes that are available to read. Returns 0 if there are no bytes available to read or the event is in an invalid state for reading.

// PROTOTYPE
int available() override 

flush - CloudEvent

It is not necessary to call flush when you are finished writing, as the writes are never buffered. This method is a no-op.

// PROTOTYPE
void flush() override