Class IStream#

Inheritance Relationships#

Derived Type#

Class Documentation#

class IStream#

Interface used for accessing the data-stream.

Implementations of this interface are expected to be thread-safe - it should be possible to call the Read-method from multiple threads simultaneously. In libCZI-usage, exceptions thrown by Read-method are wrapped into a

libCZI::LibCZIIOException-exception, where the exception thrown by the Read-method is stored as the inner exception.

Subclassed by libCZI::IInputOutputStream

Public Functions

virtual void Read(std::uint64_t offset, void *pv, std::uint64_t size, std::uint64_t *ptrBytesRead) = 0#

Reads the specified amount of data from the stream at the specified position. This method is expected to throw an exception for any kind of I/O-related error. It must not throw an exception if reading past the end of a file - instead, it must return the number of bytes actually read accordingly. For the special case of size==0, the behavior should be as follows: the method should operate as for a size>0, but it should not read any data. The method should return 0 in ptrBytesRead.

Parameters:
  • offset – The offset to start reading from.

  • pv[out] The caller-provided buffer for the data. Must be non-null.

  • size – The size of the buffer.

  • ptrBytesRead[out] If non-null, the variable pointed to will receive the number of bytes actually read.

virtual ~IStream() = default#