class eosio::datastream

Class List > eosio :: datastream

Public Functions

Type Name
datastream (T start, size_t s)
void skip (size_t s)
bool read (char * d, size_t s)
bool write (const char * d, size_t s)
bool put (char c)
bool get (unsigned char & c)
bool get (char & c)
T pos () const
bool valid () const
bool seekp (size_t p)
size_t tellp () const
size_t remaining () const

Detailed Description

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

Template parameters:

  • T - Type of the datastream buffer

Public Functions Documentation

function datastream

eosio::datastream< T >::datastream(
    T start,
    size_t s
)

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

Parameters:

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

function skip

void eosio::datastream< T >::skip(
    size_t s
)

Skips a specified number of bytes from this stream

Parameters:

  • s - The number of bytes to skip

function read

bool eosio::datastream< T >::read(
    char * d,
    size_t s
)

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

Parameters:

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

Returns:

true

function write

bool eosio::datastream< T >::write(
    const char * d,
    size_t s
)

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

Parameters:

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

Returns:

true

function put

bool eosio::datastream< T >::put(
    char c
)

Writes a byte into the stream

Parameters:

  • c byte to write

Returns:

true

function get (1/2)

bool eosio::datastream< T >::get(
    unsigned char & c
)

Reads a byte from the stream

Parameters:

  • c - The reference to destination byte

Returns:

true

function get (2/2)

bool eosio::datastream< T >::get(
    char & c
)

Reads a byte from the stream

Parameters:

  • c - The reference to destination byte

Returns:

true

function pos

T eosio::datastream< T >::pos() const

Retrieves the current position of the stream

Returns:

T - The current position of the stream

function valid

bool eosio::datastream< T >::valid() const

function seekp

bool eosio::datastream< T >::seekp(
    size_t p
)

Sets the position within the current stream

Parameters:

  • p - The offset relative to the origin

Returns:

true if p is within the range

Returns:

false if p is not within the rawnge

function tellp

size_t eosio::datastream< T >::tellp() const

Gets the position within the current stream

Returns:

p - The position within the current stream

function remaining

size_t eosio::datastream< T >::remaining() const

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

Returns:

size_t - The number of remaining bytes


The documentation for this class was generated from the following file: libraries/eosiolib/core/eosio/datastream.hpp