class MutableBinaryByteStream

Declaration

class MutableBinaryByteStream : public WritableBinaryStream { /* full declaration omitted */ };

Description

An implementation of BinaryStream which holds its entire data set in a single contiguous buffer. As with BinaryByteStream, the mutable version also guarantees that no read operation will ever incur a copy, and similarly it does not own the underlying buffer.

Declared at: llvm/include/llvm/Support/BinaryByteStream.h:88

Inherits from: WritableBinaryStream

Member Variables

private MutableArrayRef<uint8_t> Data
private llvm::BinaryByteStream ImmutableStream

Method Overview

Inherited from WritableBinaryStream:

Inherited from BinaryStream:

Methods

MutableBinaryByteStream()

Declared at: llvm/include/llvm/Support/BinaryByteStream.h:90

MutableBinaryByteStream(
    MutableArrayRef<uint8_t> Data,
    llvm::support::endianness Endian)

Declared at: llvm/include/llvm/Support/BinaryByteStream.h:91

Parameters

MutableArrayRef<uint8_t> Data
llvm::support::endianness Endian

llvm::Error commit()

Description

For buffered streams, commits changes to the backing store.

Declared at: llvm/include/llvm/Support/BinaryByteStream.h:123

MutableArrayRef<uint8_t> data() const

Declared at: llvm/include/llvm/Support/BinaryByteStream.h:125

llvm::support::endianness getEndian() const

Declared at: llvm/include/llvm/Support/BinaryByteStream.h:95

uint64_t getLength()

Description

Return the number of bytes of data in this stream.

Declared at: llvm/include/llvm/Support/BinaryByteStream.h:109

llvm::Error readBytes(uint64_t Offset,
                      uint64_t Size,
                      ArrayRef<uint8_t>& Buffer)

Description

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.

Declared at: llvm/include/llvm/Support/BinaryByteStream.h:99

Parameters

uint64_t Offset
uint64_t Size
ArrayRef<uint8_t>& Buffer

llvm::Error readLongestContiguousChunk(
    uint64_t Offset,
    ArrayRef<uint8_t>& Buffer)

Description

Given an offset into the stream, read as much as possible without copying any data.

Declared at: llvm/include/llvm/Support/BinaryByteStream.h:104

Parameters

uint64_t Offset
ArrayRef<uint8_t>& Buffer

llvm::Error writeBytes(uint64_t Offset,
                       ArrayRef<uint8_t> Buffer)

Description

Attempt to write the given bytes into the stream at the desired offset. This will always necessitate a copy. Cannot shrink or grow the stream, only writes into existing allocated space.

Declared at: llvm/include/llvm/Support/BinaryByteStream.h:111

Parameters

uint64_t Offset
ArrayRef<uint8_t> Buffer