LLVM 20.0.0git
Public Member Functions | Protected Member Functions | List of all members
llvm::WritableBinaryStream Class Referenceabstract

A BinaryStream which can be read from as well as written to. More...

#include "llvm/Support/BinaryStream.h"

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

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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~WritableBinaryStream()

llvm::WritableBinaryStream::~WritableBinaryStream ( )
overridedefault

Member Function Documentation

◆ checkOffsetForWrite()

Error llvm::WritableBinaryStream::checkOffsetForWrite ( uint64_t  Offset,
uint64_t  DataSize 
)
inlineprotected

◆ commit()

virtual Error llvm::WritableBinaryStream::commit ( )
pure virtual

◆ getFlags()

BinaryStreamFlags llvm::WritableBinaryStream::getFlags ( ) const
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().

◆ writeBytes()

virtual Error llvm::WritableBinaryStream::writeBytes ( uint64_t  Offset,
ArrayRef< uint8_t >  Data 
)
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().


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