class FileBufferByteStream

Declaration

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

Description

An implementation of WritableBinaryStream backed by an llvm FileOutputBuffer.

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

Inherits from: WritableBinaryStream

Method Overview

Inherited from WritableBinaryStream:

Inherited from BinaryStream:

Methods

FileBufferByteStream(
    std::unique_ptr<FileOutputBuffer> Buffer,
    llvm::support::endianness Endian)

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

Parameters

std::unique_ptr<FileOutputBuffer> Buffer
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:259

uint8_t* getBufferEnd() const

Description

Returns a pointer to the end of the buffer.

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

uint8_t* getBufferStart() const

Description

Returns a pointer to the start of the buffer.

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

llvm::support::endianness getEndian() const

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

uint32_t getLength()

Description

Return the number of bytes of data in this stream.

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

llvm::Error readBytes(uint32_t Offset,
                      uint32_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:243

Parameters

uint32_t Offset
uint32_t Size
ArrayRef<uint8_t>& Buffer

llvm::Error readLongestContiguousChunk(
    uint32_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:248

Parameters

uint32_t Offset
ArrayRef<uint8_t>& Buffer

llvm::Error writeBytes(uint32_t Offset,
                       ArrayRef<uint8_t> Data)

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:255

Parameters

uint32_t Offset
ArrayRef<uint8_t> Data