LLVM
8.0.1
|
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 (uint32_t Offset, ArrayRef< uint8_t > Data)=0 |
Attempt to write the given bytes into the stream at the desired offset. More... | |
virtual Error | commit ()=0 |
For buffered streams, commits changes to the backing store. More... | |
BinaryStreamFlags | getFlags () const override |
Return the properties of this stream. More... | |
Public Member Functions inherited from llvm::BinaryStream | |
virtual | ~BinaryStream ()=default |
virtual llvm::support::endianness | getEndian () const =0 |
virtual Error | readBytes (uint32_t Offset, uint32_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. More... | |
virtual Error | readLongestContiguousChunk (uint32_t Offset, ArrayRef< uint8_t > &Buffer)=0 |
Given an offset into the stream, read as much as possible without copying any data. More... | |
virtual uint32_t | getLength ()=0 |
Return the number of bytes of data in this stream. More... | |
Protected Member Functions | |
Error | checkOffsetForWrite (uint32_t Offset, uint32_t DataSize) |
Protected Member Functions inherited from llvm::BinaryStream | |
Error | checkOffsetForRead (uint32_t Offset, uint32_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 74 of file BinaryStream.h.
|
overridedefault |
|
inlineprotected |
Definition at line 90 of file BinaryStream.h.
References llvm::BSF_Append, llvm::BinaryStream::checkOffsetForRead(), llvm::BinaryStream::getFlags(), llvm::BinaryStream::getLength(), llvm::invalid_offset, and llvm::Error::success().
Referenced by llvm::msf::WritableMappedBlockStream::writeBytes().
|
pure virtual |
For buffered streams, commits changes to the backing store.
Implemented in llvm::FileBufferByteStream, llvm::AppendingBinaryByteStream, llvm::msf::WritableMappedBlockStream, and llvm::MutableBinaryByteStream.
Referenced by llvm::WritableBinaryStreamRef::commit().
|
inlineoverridevirtual |
Return the properties of this stream.
Reimplemented from llvm::BinaryStream.
Definition at line 87 of file BinaryStream.h.
References llvm::BSF_Write.
|
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::FileBufferByteStream, llvm::AppendingBinaryByteStream, llvm::msf::WritableMappedBlockStream, and llvm::MutableBinaryByteStream.
Referenced by llvm::WritableBinaryStreamRef::writeBytes().