llvm::BinaryStream

An interface for accessing data in a stream-like format without copying.

Synopsis

Declared in <llvm/Support/BinaryStream.h>

class BinaryStream;

Description

Instead of specifying a buffer in which to copy data on a read, the API returns an ArrayRef to data owned by the stream's implementation. Since implementations may not necessarily store data in a single contiguous buffer (or even in memory at all), in such cases a it may be necessary for an implementation to cache such a buffer so that it can return it.

Member Functions

NameDescription
~BinaryStream [destructor] [virtual]Destroy a BinaryStream.
getEndian [virtual]Return the endianness of multi-byte values in this stream.
getFlags [virtual]Return the properties of this stream.
getLength [virtual]Return the number of bytes of data in this stream.
readBytes [virtual]Given an offset into the stream and a number of bytes, attempt to read the bytes and set the output ArrayRef to point to data owned by the stream.
readLongestContiguousChunk [virtual]Given an offset into the stream, read as much as possible without copying any data.

Protected Member Functions

NameDescription
checkOffsetForRead Check that Offset and DataSize form a valid read range.

Derived Classes

NameDescription
BinaryByteStream BinaryStream backed by a single contiguous buffer that never copies on read.
BinaryItemStream A BinaryStream over a sequence of items from an external container.
MappedBlockStream A BinaryStream view of data stored as possibly discontiguous MSF blocks.
WritableBinaryStream A BinaryStream that supports both reading and writing.