LLVM 20.0.0git
Classes | Public Member Functions | List of all members
llvm::FileBufferByteStream Class Reference

An implementation of WritableBinaryStream backed by an llvm FileOutputBuffer. More...

#include "llvm/Support/BinaryByteStream.h"

Inheritance diagram for llvm::FileBufferByteStream:
Inheritance graph
[legend]

Public Member Functions

 FileBufferByteStream (std::unique_ptr< FileOutputBuffer > Buffer, llvm::endianness Endian)
 
llvm::endianness getEndian () const override
 
Error readBytes (uint64_t Offset, uint64_t Size, ArrayRef< uint8_t > &Buffer) override
 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.
 
Error readLongestContiguousChunk (uint64_t Offset, ArrayRef< uint8_t > &Buffer) override
 Given an offset into the stream, read as much as possible without copying any data.
 
uint64_t getLength () override
 Return the number of bytes of data in this stream.
 
Error writeBytes (uint64_t Offset, ArrayRef< uint8_t > Data) override
 Attempt to write the given bytes into the stream at the desired offset.
 
Error commit () override
 For buffered streams, commits changes to the backing store.
 
uint8_t * getBufferStart () const
 Returns a pointer to the start of the buffer.
 
uint8_t * getBufferEnd () const
 Returns a pointer to the end of the buffer.
 
- Public Member Functions inherited from llvm::WritableBinaryStream
 ~WritableBinaryStream () override=default
 
virtual Error writeBytes (uint64_t Offset, ArrayRef< uint8_t > Data)=0
 Attempt to write the given bytes into the stream at the desired offset.
 
virtual Error commit ()=0
 For buffered streams, commits changes to the backing store.
 
BinaryStreamFlags getFlags () const override
 Return the properties of this stream.
 
- Public Member Functions inherited from llvm::BinaryStream
virtual ~BinaryStream ()=default
 
virtual llvm::endianness getEndian () const =0
 
virtual Error readBytes (uint64_t Offset, uint64_t Size, ArrayRef< uint8_t > &Buffer)=0
 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.
 
virtual Error readLongestContiguousChunk (uint64_t Offset, ArrayRef< uint8_t > &Buffer)=0
 Given an offset into the stream, read as much as possible without copying any data.
 
virtual uint64_t getLength ()=0
 Return the number of bytes of data in this stream.
 
virtual BinaryStreamFlags getFlags () const
 Return the properties of this stream.
 

Additional Inherited Members

- Protected Member Functions inherited from llvm::WritableBinaryStream
Error checkOffsetForWrite (uint64_t Offset, uint64_t DataSize)
 
- Protected Member Functions inherited from llvm::BinaryStream
Error checkOffsetForRead (uint64_t Offset, uint64_t DataSize)
 

Detailed Description

An implementation of WritableBinaryStream backed by an llvm FileOutputBuffer.

Definition at line 201 of file BinaryByteStream.h.

Constructor & Destructor Documentation

◆ FileBufferByteStream()

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

Definition at line 231 of file BinaryByteStream.h.

Member Function Documentation

◆ commit()

Error llvm::FileBufferByteStream::commit ( )
inlineoverridevirtual

For buffered streams, commits changes to the backing store.

Implements llvm::WritableBinaryStream.

Definition at line 253 of file BinaryByteStream.h.

Referenced by llvm::pdb::PDBFileBuilder::commit().

◆ getBufferEnd()

uint8_t * llvm::FileBufferByteStream::getBufferEnd ( ) const
inline

Returns a pointer to the end of the buffer.

Definition at line 259 of file BinaryByteStream.h.

Referenced by llvm::pdb::PDBFileBuilder::commit().

◆ getBufferStart()

uint8_t * llvm::FileBufferByteStream::getBufferStart ( ) const
inline

Returns a pointer to the start of the buffer.

Definition at line 256 of file BinaryByteStream.h.

Referenced by llvm::pdb::PDBFileBuilder::commit().

◆ getEndian()

llvm::endianness llvm::FileBufferByteStream::getEndian ( ) const
inlineoverridevirtual

Implements llvm::BinaryStream.

Definition at line 235 of file BinaryByteStream.h.

◆ getLength()

uint64_t llvm::FileBufferByteStream::getLength ( )
inlineoverridevirtual

Return the number of bytes of data in this stream.

Implements llvm::BinaryStream.

Definition at line 247 of file BinaryByteStream.h.

◆ readBytes()

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

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.

Implements llvm::BinaryStream.

Definition at line 237 of file BinaryByteStream.h.

References llvm::Offset, and Size.

◆ readLongestContiguousChunk()

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

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

Implements llvm::BinaryStream.

Definition at line 242 of file BinaryByteStream.h.

References llvm::Offset.

◆ writeBytes()

Error llvm::FileBufferByteStream::writeBytes ( uint64_t  Offset,
ArrayRef< uint8_t >  Data 
)
inlineoverridevirtual

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.

Implements llvm::WritableBinaryStream.

Definition at line 249 of file BinaryByteStream.h.

References llvm::Data, and llvm::Offset.


The documentation for this class was generated from the following file: