eckit::codec::Stream class

Handle to a shared eckit::DataHandle.

Note, a Stream is not intended to be opened and closed within eckit::codec context The derived classes InputFileStream and OutputFileStream automatically open and close on construction an destruction.

Derived classes

class FileStream

Constructors, destructors, conversion operators

Stream() defaulted
Stream(DataHandle*) explicit
Constructor taking ownership of datahandle.
Stream(std::shared_ptr<DataHandle>) explicit
Constructor to share datahandle with a shared_ptr.
Stream(DataHandle&)
Stream(const Stream&)
Assignment constructor sharing datahandle with other Stream.
operator bool() const explicit
Return true if pointer is valid;.

Public functions

auto datahandle() -> DataHandle&
Access internal DataHandle.
auto seek(std::uint64_t offset) -> std::uint64_t
Move position to given offset.
auto position() -> std::uint64_t
Return offset of current position.
auto write(const void* data, size_t length) -> std::uint64_t
auto read(void* data, size_t length) -> std::uint64_t

Function documentation

eckit::codec::Stream::Stream() defaulted

Default constructor

eckit::codec::Stream::Stream(DataHandle&)

Constructor referencing datahandle, no ownership is taken

std::uint64_t eckit::codec::Stream::write(const void* data, size_t length)

Returns number of bytes written

Write data of given length (bytes)

std::uint64_t eckit::codec::Stream::read(void* data, size_t length)

Returns number of bytes read

Read data of given length (bytes)