View on GitHub

DSFML

dsfml.system.inputstream

A module containing the InputStream interface.

interface InputStream;
Abstract class for custom file input streams.

This class allows users to define their own file input sources from which SFML can load resources.

SFML resource classes like sf::Texture and sf::SoundBuffer provide loadFromFile and loadFromMemory functions, which read data from conventional sources. However, if you have data coming from a different source (over a network, embedded, encrypted, compressed, etc) you can derive your own class from sf::InputStream and load SFML resources with their loadFromStream function.

abstract long read(void[] data);
Read data from the stream.

Params:
void[] data Buffer where to copy the read data

and sized to the amount of bytes to be read.

Returns:
The number of bytes actually read, or -1 on error.

abstract long seek(long position);
Change the current reading position.

Params:
long position The position to seek to, from the beginning.

Returns:
The position actually sought to, or -1 on error.

abstract long tell();
Get the current reading position in the stream.

Returns:
The current position, or -1 on error.

abstract long getSize();
Return the size of the stream.

Returns:
The total number of bytes available in the stream, or -1 on error.