LLVM  6.0.0svn
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]
Collaboration diagram for llvm::FileBufferByteStream:
Collaboration graph
[legend]

Public Member Functions

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

Additional Inherited Members

- Protected Member Functions inherited from llvm::BinaryStream
Error checkOffset (uint32_t Offset, uint32_t DataSize)
 

Detailed Description

An implementation of WritableBinaryStream backed by an llvm FileOutputBuffer.

Definition at line 136 of file BinaryByteStream.h.

Constructor & Destructor Documentation

◆ FileBufferByteStream()

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

Definition at line 160 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 184 of file BinaryByteStream.h.

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

◆ getEndian()

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

Implements llvm::BinaryStream.

Definition at line 164 of file BinaryByteStream.h.

◆ getLength()

uint32_t llvm::FileBufferByteStream::getLength ( )
inlineoverridevirtual

Return the number of bytes of data in this stream.

Implements llvm::BinaryStream.

Definition at line 178 of file BinaryByteStream.h.

◆ readBytes()

Error llvm::FileBufferByteStream::readBytes ( uint32_t  Offset,
uint32_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 168 of file BinaryByteStream.h.

◆ readLongestContiguousChunk()

Error llvm::FileBufferByteStream::readLongestContiguousChunk ( uint32_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 173 of file BinaryByteStream.h.

◆ writeBytes()

Error llvm::FileBufferByteStream::writeBytes ( uint32_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 180 of file BinaryByteStream.h.


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