UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FCompressedBufferReader Class Reference

#include <CompressedBuffer.h>

Public Member Functions

 FCompressedBufferReader ()=default
 
CORE_API FCompressedBufferReader (FArchive &Archive)
 
CORE_API FCompressedBufferReader (const FCompressedBuffer &Buffer)
 
CORE_API void ResetBuffers ()
 
CORE_API void ResetSource ()
 
CORE_API void SetSource (FArchive &Archive)
 
CORE_API void SetSource (const FCompressedBuffer &Buffer)
 
bool HasSource () const
 
CORE_API uint64 GetCompressedSize ()
 
CORE_API uint64 GetRawSize ()
 
CORE_API FIoHash GetRawHash ()
 
CORE_API bool TryGetCompressParameters (ECompressedBufferCompressor &OutCompressor, ECompressedBufferCompressionLevel &OutCompressionLevel, uint64 &OutBlockSize)
 
CORE_API bool TryDecompressTo (FMutableMemoryView RawView, uint64 RawOffset=0, ECompressedBufferDecompressFlags Flags=ECompressedBufferDecompressFlags::None)
 
CORE_API FSharedBuffer Decompress (uint64 RawOffset=0, uint64 RawSize=MAX_uint64)
 
CORE_API FCompositeBuffer DecompressToComposite (uint64 RawOffset=0, uint64 RawSize=MAX_uint64)
 

Detailed Description

A type that stores the state needed to decompress a compressed buffer.

The compressed buffer can be in memory or can be loaded from a seekable archive.

The reader can be reused across multiple source buffers, which allows its temporary buffers to be reused if they are the right size.

It is only safe to use the reader from one thread at a time.

See also
FCompressedBuffer

Constructor & Destructor Documentation

◆ FCompressedBufferReader() [1/3]

FCompressedBufferReader::FCompressedBufferReader ( )
default

Construct a reader with no source.

◆ FCompressedBufferReader() [2/3]

FCompressedBufferReader::FCompressedBufferReader ( FArchive Archive)
explicit

Construct a reader that will read from an archive as needed.

◆ FCompressedBufferReader() [3/3]

FCompressedBufferReader::FCompressedBufferReader ( const FCompressedBuffer Buffer)
explicit

Construct a reader from an in-memory compressed buffer.

Member Function Documentation

◆ Decompress()

FSharedBuffer FCompressedBufferReader::Decompress ( uint64  RawOffset = 0,
uint64  RawSize = MAX_uint64 
)

Decompress into an owned buffer.

RawOffset must be at most the raw buffer size. RawSize may be MAX_uint64 to read the whole buffer from RawOffset, and must otherwise fit within the bounds of the buffer.

Parameters
RawOffsetThe offset into the raw data from which to decompress.
RawSizeThe size of the raw data to read from the offset.
Returns
An owned buffer containing the raw data, or null on error.

◆ DecompressToComposite()

FCompositeBuffer FCompressedBufferReader::DecompressToComposite ( uint64  RawOffset = 0,
uint64  RawSize = MAX_uint64 
)

◆ GetCompressedSize()

uint64 FCompressedBufferReader::GetCompressedSize ( )

Returns the size of the compressed data. Zero on error.

◆ GetRawHash()

FIoHash FCompressedBufferReader::GetRawHash ( )

Returns the hash of the raw data. Zero on error.

◆ GetRawSize()

uint64 FCompressedBufferReader::GetRawSize ( )

Returns the size of the raw data. Zero on error.

◆ HasSource()

bool FCompressedBufferReader::HasSource ( ) const
inline

◆ ResetBuffers()

void FCompressedBufferReader::ResetBuffers ( )

Release any temporary buffers that have been allocated by the reader.

◆ ResetSource()

void FCompressedBufferReader::ResetSource ( )

Clears the reference to the source without releasing temporary buffers.

◆ SetSource() [1/2]

void FCompressedBufferReader::SetSource ( const FCompressedBuffer Buffer)

◆ SetSource() [2/2]

void FCompressedBufferReader::SetSource ( FArchive Archive)

◆ TryDecompressTo()

bool FCompressedBufferReader::TryDecompressTo ( FMutableMemoryView  RawView,
uint64  RawOffset = 0,
ECompressedBufferDecompressFlags  Flags = ECompressedBufferDecompressFlags::None 
)

Decompress into a memory view that is less than or equal to the available raw size.

Parameters
RawViewThe view to write to. The size to read is equal to the view size.
RawOffsetThe offset into the raw data from which to decompress.
Returns
True if the requested range was decompressed, otherwise false.

◆ TryGetCompressParameters()

bool FCompressedBufferReader::TryGetCompressParameters ( ECompressedBufferCompressor OutCompressor,
ECompressedBufferCompressionLevel OutCompressionLevel,
uint64 OutBlockSize 
)

Returns the compressor and compression level used by this buffer.

The compressor and compression level may differ from those specified when creating the buffer because an incompressible buffer is stored with no compression. Parameters cannot be accessed if this is null or uses a method other than Oodle, in which case this returns false.

Returns
True if parameters were written, otherwise false.

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