LLVM 20.0.0git
|
A BinaryStream which can be read from as well as written to. More...
#include "llvm/Support/BinaryStream.h"
Public Member Functions | |
~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. | |
Protected Member Functions | |
Error | checkOffsetForWrite (uint64_t Offset, uint64_t DataSize) |
Protected Member Functions inherited from llvm::BinaryStream | |
Error | checkOffsetForRead (uint64_t Offset, uint64_t DataSize) |
A BinaryStream which can be read from as well as written to.
Note that writing to a BinaryStream always necessitates copying from the input buffer to the stream's backing store. Streams are assumed to be buffered so that to be portable it is necessary to call commit() on the stream when all data has been written.
Definition at line 72 of file BinaryStream.h.
|
overridedefault |
|
inlineprotected |
Definition at line 88 of file BinaryStream.h.
References llvm::BSF_Append, llvm::BinaryStream::checkOffsetForRead(), getFlags(), llvm::BinaryStream::getLength(), llvm::invalid_offset, llvm::Offset, and llvm::Error::success().
Referenced by llvm::AppendingBinaryByteStream::readBytes(), llvm::AppendingBinaryByteStream::readLongestContiguousChunk(), llvm::msf::WritableMappedBlockStream::writeBytes(), and llvm::MutableBinaryByteStream::writeBytes().
|
pure virtual |
For buffered streams, commits changes to the backing store.
Implemented in llvm::msf::WritableMappedBlockStream, llvm::MutableBinaryByteStream, llvm::AppendingBinaryByteStream, and llvm::FileBufferByteStream.
Referenced by llvm::WritableBinaryStreamRef::commit().
|
inlineoverridevirtual |
Return the properties of this stream.
Reimplemented from llvm::BinaryStream.
Definition at line 85 of file BinaryStream.h.
References llvm::BSF_Write.
Referenced by checkOffsetForWrite().
|
pure virtual |
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.
Implemented in llvm::msf::WritableMappedBlockStream, llvm::MutableBinaryByteStream, llvm::AppendingBinaryByteStream, and llvm::FileBufferByteStream.
Referenced by llvm::WritableBinaryStreamRef::writeBytes().