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

#include <CompressedBuffer.h>

Public Member Functions

CORE_API void Save (FArchive &Ar) const
 
void Reset ()
 
 operator bool () const
 
bool IsNull () const
 
bool IsOwned () const
 
FCompressedBuffer MakeOwned () const &
 
FCompressedBuffer MakeOwned () &&
 
const FCompositeBufferGetCompressed () const &
 
FCompositeBuffer GetCompressed () &&
 
CORE_API uint64 GetCompressedSize () const
 
CORE_API uint64 GetRawSize () const
 
CORE_API FIoHash GetRawHash () const
 
CORE_API bool TryGetCompressParameters (ECompressedBufferCompressor &OutCompressor, ECompressedBufferCompressionLevel &OutCompressionLevel, uint64 &OutBlockSize) const
 
CORE_API bool TryDecompressTo (FMutableMemoryView RawView, ECompressedBufferDecompressFlags Flags=ECompressedBufferDecompressFlags::None) const
 
CORE_API FSharedBuffer Decompress () const
 
CORE_API FCompositeBuffer DecompressToComposite () const
 

Static Public Member Functions

static CORE_API FCompressedBuffer Compress (const FCompositeBuffer &RawData)
 
static CORE_API FCompressedBuffer Compress (const FSharedBuffer &RawData)
 
static CORE_API FCompressedBuffer Compress (const FCompositeBuffer &RawData, ECompressedBufferCompressor Compressor, ECompressedBufferCompressionLevel CompressionLevel, uint64 BlockSize=0)
 
static CORE_API FCompressedBuffer Compress (const FSharedBuffer &RawData, ECompressedBufferCompressor Compressor, ECompressedBufferCompressionLevel CompressionLevel, uint64 BlockSize=0)
 
static CORE_API FCompressedBuffer FromCompressed (const FCompositeBuffer &CompressedData)
 
static CORE_API FCompressedBuffer FromCompressed (FCompositeBuffer &&CompressedData)
 
static CORE_API FCompressedBuffer FromCompressed (const FSharedBuffer &CompressedData)
 
static CORE_API FCompressedBuffer FromCompressed (FSharedBuffer &&CompressedData)
 
static CORE_API FCompressedBuffer Load (FArchive &Ar)
 

Static Public Attributes

static CORE_API const FCompressedBuffer Null
 

Detailed Description

A compressed buffer stores compressed data in a self-contained format.

A buffer is self-contained in the sense that it can be decompressed without external knowledge of the compression format or the size of the raw data.

The buffer may be partially decompressed using FCompressedBufferReader.

See also
FCompressedBufferReader

Member Function Documentation

◆ Compress() [1/4]

FCompressedBuffer FCompressedBuffer::Compress ( const FCompositeBuffer RawData)
static

Compress the buffer using a balanced level of compression.

Returns
An owned compressed buffer, or null on error.

◆ Compress() [2/4]

FCompressedBuffer FCompressedBuffer::Compress ( const FCompositeBuffer RawData,
ECompressedBufferCompressor  Compressor,
ECompressedBufferCompressionLevel  CompressionLevel,
uint64  BlockSize = 0 
)
static

Compress the buffer using the specified compressor and compression level.

Data that does not compress will be return uncompressed, as if with level None.

Note
Using a level of None will return a buffer that references owned raw data.
Parameters
RawDataThe raw data to be compressed.
CompressorThe compressor to encode with. May use NotSet if level is None.
CompressionLevelThe compression level to encode with.
BlockSizeThe power-of-two block size to encode raw data in. 0 is default.
Returns
An owned compressed buffer, or null on error.

◆ Compress() [3/4]

FCompressedBuffer FCompressedBuffer::Compress ( const FSharedBuffer RawData)
static

◆ Compress() [4/4]

FCompressedBuffer FCompressedBuffer::Compress ( const FSharedBuffer RawData,
ECompressedBufferCompressor  Compressor,
ECompressedBufferCompressionLevel  CompressionLevel,
uint64  BlockSize = 0 
)
static

◆ Decompress()

FSharedBuffer FCompressedBuffer::Decompress ( ) const

Decompress into an owned buffer.

Returns
An owned buffer containing the raw data, or null on error.

◆ DecompressToComposite()

FCompositeBuffer FCompressedBuffer::DecompressToComposite ( ) const

◆ FromCompressed() [1/4]

FCompressedBuffer FCompressedBuffer::FromCompressed ( const FCompositeBuffer CompressedData)
static

Construct from a compressed buffer previously created by Compress().

Returns
A compressed buffer, or null on error, such as an invalid format or corrupt header.

◆ FromCompressed() [2/4]

FCompressedBuffer FCompressedBuffer::FromCompressed ( const FSharedBuffer CompressedData)
static

◆ FromCompressed() [3/4]

FCompressedBuffer FCompressedBuffer::FromCompressed ( FCompositeBuffer &&  CompressedData)
static

◆ FromCompressed() [4/4]

FCompressedBuffer FCompressedBuffer::FromCompressed ( FSharedBuffer &&  CompressedData)
static

◆ GetCompressed() [1/2]

FCompositeBuffer FCompressedBuffer::GetCompressed ( ) &&
inline

◆ GetCompressed() [2/2]

const FCompositeBuffer & FCompressedBuffer::GetCompressed ( ) const &
inline

Returns a composite buffer containing the compressed data. May be null. May not be owned.

◆ GetCompressedSize()

uint64 FCompressedBuffer::GetCompressedSize ( ) const

Returns the size of the compressed data. Zero on error or if this is null.

◆ GetRawHash()

FIoHash FCompressedBuffer::GetRawHash ( ) const

Returns the hash of the raw data. Zero on error or if this is null.

◆ GetRawSize()

uint64 FCompressedBuffer::GetRawSize ( ) const

Returns the size of the raw data. Zero on error or if this is empty or null.

◆ IsNull()

bool FCompressedBuffer::IsNull ( ) const
inline

Returns true if the compressed buffer is null.

◆ IsOwned()

bool FCompressedBuffer::IsOwned ( ) const
inline

Returns true if the composite buffer is owned.

◆ Load()

FCompressedBuffer FCompressedBuffer::Load ( FArchive Ar)
static

Load a compressed buffer from an archive, as saved by Save().

The entire compressed buffer will be loaded from the archive before this function returns. Prefer to use FCompressedBufferReader to stream from an archive when the compressed buffer does not need to be fully loaded into memory.

Returns
A compressed buffer, or null on error. Ar.IsError() will be true on error.

◆ MakeOwned() [1/2]

FCompressedBuffer FCompressedBuffer::MakeOwned ( ) &&
inline

◆ MakeOwned() [2/2]

FCompressedBuffer FCompressedBuffer::MakeOwned ( ) const &
inline

Returns a copy of the compressed buffer that owns its underlying memory.

◆ operator bool()

FCompressedBuffer::operator bool ( ) const
inlineexplicit

Returns true if the compressed buffer is not null.

◆ Reset()

void FCompressedBuffer::Reset ( )
inline

Reset this to null.

◆ Save()

void FCompressedBuffer::Save ( FArchive Ar) const

Save the compressed buffer to an archive.

◆ TryDecompressTo()

bool FCompressedBuffer::TryDecompressTo ( FMutableMemoryView  RawView,
ECompressedBufferDecompressFlags  Flags = ECompressedBufferDecompressFlags::None 
) const

Decompress into a memory view that is exactly equal to the raw size.

Returns
True if the requested range was decompressed, otherwise false.

◆ TryGetCompressParameters()

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

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.

Member Data Documentation

◆ Null

const FCompressedBuffer FCompressedBuffer::Null
static

A null compressed buffer.


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