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

Inherits from: WritableBinaryStream

Member Variables

private llvm::FileBufferByteStream::StreamImpl Impl

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

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

uint8_t* getBufferEnd() const

Description

Returns a pointer to the end of the buffer.

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

uint8_t* getBufferStart() const

Description

Returns a pointer to the start of the buffer.

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

llvm::support::endianness getEndian() const

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

uint64_t getLength()

Description

Return the number of bytes of data in this stream.

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

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

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

Parameters

uint64_t Offset
ArrayRef<uint8_t>& Buffer

llvm::Error writeBytes(uint64_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:252

Parameters

uint64_t Offset
ArrayRef<uint8_t> Data