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)
Writes a byte into the stream.
bool get (unsigned char & c)
Reads a byte from the stream.
bool get (char & c)
Reads a byte from the stream.
T pos () const
Retrieves the current position of the stream.
bool valid () const
bool seekp (size_t p)
Sets the position within the current stream.
size_t tellp () const
Gets the position within the current stream.
size_t remaining () const
Returns the number of remaining bytes that can be read/skipped.

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::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::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::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::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::put (
    char c
)

Writes a byte into the stream.

Writes a byte into the stream

Parameters:

  • c byte to write

Returns:

true

function get (1/2)

bool eosio::datastream::get (
    unsigned char & c
)

Reads a byte from the stream.

Reads a byte from the stream

Parameters:

  • c - The reference to destination byte

Returns:

true

function get (2/2)

bool eosio::datastream::get (
    char & c
)

Reads a byte from the stream.

Reads a byte from the stream

Parameters:

  • c - The reference to destination byte

Returns:

true

function pos

T eosio::datastream::pos () const

Retrieves the current position of the stream.

Retrieves the current position of the stream

Returns:

T - The current position of the stream

function valid

bool eosio::datastream::valid () const

function seekp

bool eosio::datastream::seekp (
    size_t p
)

Sets the position within the current stream.

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::tellp () const

Gets the position within the current stream.

Gets the position within the current stream

Returns:

p - The position within the current stream

function remaining

size_t eosio::datastream::remaining () const

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

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: in/eosio.cdt/libraries/eosiolib/core/eosio/datastream.hpp

results matching ""

    No results matching ""