Skip to main content

eosio::datastream

More...

#include <datastream.hpp>

Public Functions

Name
datastream(T start, size_t s)
voidskip(size_t s)
boolread(char * d, size_t s)
boolwrite(const char * d, size_t s)
boolwrite(char d)
boolwrite(const void * d, size_t s)
boolput(char c)
boolget(unsigned char & c)
boolget(char & c)
Tpos() const
boolvalid() const
boolseekp(size_t p)
size_ttellp() const
size_tremaining() const

Detailed Description

template <typename T >
class eosio::datastream;

Template Parameters:

  • T - Type of the datastream buffer

A data stream for reading and writing data in the form of bytes

Public Functions Documentation

function datastream

inline datastream(
T start,
size_t s
)

Parameters:

  • start - The start position of the buffer
  • s - The size of the buffer

Construct a new datastream object

Construct a new datastream object given the size of the buffer and start position of the buffer

function skip

inline void skip(
size_t s
)

Parameters:

  • s - The number of bytes to skip

Skips a specified number of bytes from this stream

function read

inline bool read(
char * d,
size_t s
)

Parameters:

  • d - The pointer to the destination buffer
  • s - the number of bytes to read

Return: true

Reads a specified number of bytes from the stream into a buffer

function write

inline bool write(
const char * d,
size_t s
)

Parameters:

  • d - The pointer to the source buffer
  • s - The number of bytes to write

Return: true

Writes a specified number of bytes into the stream from a buffer

function write

inline bool write(
char d
)

Parameters:

  • d - The byte to be written

Return: true

Writes a specified byte into the stream from a buffer

function write

inline bool write(
const void * d,
size_t s
)

Parameters:

  • d - The pointer to the source buffer
  • s - The number of bytes to write

Return: true

Writes a specified number of bytes into the stream from a buffer

function put

inline bool put(
char c
)

Parameters:

  • c byte to write

Return: true

Writes a byte into the stream

function get

inline bool get(
unsigned char & c
)

Parameters:

  • c - The reference to destination byte

Return: true

Reads a byte from the stream

function get

inline bool get(
char & c
)

Parameters:

  • c - The reference to destination byte

Return: true

Reads a byte from the stream

function pos

inline T pos() const

Return: T - The current position of the stream

Retrieves the current position of the stream

function valid

inline bool valid() const

function seekp

inline bool seekp(
size_t p
)

Parameters:

  • p - The offset relative to the origin

Return:

  • true if p is within the range
  • false if p is not within the rawnge

Sets the position within the current stream

function tellp

inline size_t tellp() const

Return: p - The position within the current stream

Gets the position within the current stream

function remaining

inline size_t remaining() const

Return: size_t - The number of remaining bytes

Returns the number of remaining bytes that can be read/skipped


Updated on 2022-12-05 at 15:38:07 +0000