LLVM 20.0.0git
|
An implementation of BinaryStream which holds its entire data set in a single contiguous buffer. More...
#include "llvm/Support/BinaryByteStream.h"
Public Member Functions | |
BinaryByteStream ()=default | |
BinaryByteStream (ArrayRef< uint8_t > Data, llvm::endianness Endian) | |
BinaryByteStream (StringRef Data, 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. | |
ArrayRef< uint8_t > | data () const |
StringRef | str () const |
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 Attributes | |
llvm::endianness | Endian |
ArrayRef< uint8_t > | Data |
Additional Inherited Members | |
Protected Member Functions inherited from llvm::BinaryStream | |
Error | checkOffsetForRead (uint64_t Offset, uint64_t DataSize) |
An implementation of BinaryStream which holds its entire data set in a single contiguous buffer.
BinaryByteStream guarantees that no read operation will ever incur a copy. Note that BinaryByteStream does not own the underlying buffer.
Definition at line 30 of file BinaryByteStream.h.
|
default |
|
inline |
Definition at line 33 of file BinaryByteStream.h.
|
inline |
Definition at line 35 of file BinaryByteStream.h.
Definition at line 58 of file BinaryByteStream.h.
References Data.
Referenced by llvm::object::ResourceSectionRef::getContents(), and llvm::object::ResourceSectionRef::getTableEntry().
|
inlineoverridevirtual |
Implements llvm::BinaryStream.
Definition at line 38 of file BinaryByteStream.h.
References Endian.
Referenced by llvm::MutableBinaryByteStream::getEndian().
|
inlineoverridevirtual |
Return the number of bytes of data in this stream.
Implements llvm::BinaryStream.
Definition at line 56 of file BinaryByteStream.h.
References Data, and llvm::ArrayRef< T >::size().
Referenced by llvm::MutableBinaryByteStream::getLength().
|
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 40 of file BinaryByteStream.h.
References llvm::BinaryStream::checkOffsetForRead(), Data, llvm::Offset, Size, llvm::ArrayRef< T >::slice(), and llvm::Error::success().
Referenced by llvm::MutableBinaryByteStream::readBytes().
|
inlineoverridevirtual |
Given an offset into the stream, read as much as possible without copying any data.
Implements llvm::BinaryStream.
Definition at line 48 of file BinaryByteStream.h.
References llvm::BinaryStream::checkOffsetForRead(), Data, llvm::Offset, llvm::ArrayRef< T >::slice(), and llvm::Error::success().
Referenced by llvm::MutableBinaryByteStream::readLongestContiguousChunk().
|
inline |
Definition at line 60 of file BinaryByteStream.h.
References llvm::ArrayRef< T >::data(), Data, and llvm::ArrayRef< T >::size().
Definition at line 67 of file BinaryByteStream.h.
Referenced by data(), getLength(), readBytes(), readLongestContiguousChunk(), and str().
|
protected |
Definition at line 66 of file BinaryByteStream.h.
Referenced by getEndian().