struct Core::IO::IByteStream

Overview

The byte stream interface represents a sequence of bytes which can be read from/written to some underlying storage. More…

#include <corestream.h>

struct IByteStream
{
    // fields

    static const InterfaceID kIID = FOUR_CHAR_ID('B','S','t','r');

    // methods

    virtual int64 getPosition() = 0;
    virtual int64 setPosition(int64 pos, int mode) = 0;
    virtual int readBytes(void* buffer, int size) = 0;
    virtual int writeBytes(const void* buffer, int size) = 0;
};

// direct descendants

class Stream;

Detailed Documentation

The byte stream interface represents a sequence of bytes which can be read from/written to some underlying storage.

Methods

virtual int64 getPosition() = 0

Get current read/write position.

virtual int64 setPosition(int64 pos, int mode) = 0

Set current read/write position.

See also:

SeekMode

virtual int readBytes(void* buffer, int size) = 0

Read data from stream.

Returns:

number of bytes read or -1 for error

virtual int writeBytes(const void* buffer, int size) = 0

Write data to stream.

Returns:

number of bytes written or -1 for error