UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FBase64 Struct Reference

#include <Base64.h>

Public Member Functions

template<typename CharType >
uint32 Encode (const uint8 *Source, uint32 Length, CharType *Dest, EBase64Mode Mode)
 
template<typename CharType >
bool Decode (const CharType *Source, uint32 Length, uint8 *Dest, EBase64Mode Mode)
 
template<typename CharType >
uint32 GetDecodedDataSize (const CharType *Source, uint32 Length)
 

Static Public Member Functions

static CORE_API FString Encode (const FString &Source, EBase64Mode Mode=EBase64Mode::Standard)
 
static CORE_API FString Encode (const TArray< uint8 > &Source, EBase64Mode Mode=EBase64Mode::Standard)
 
static CORE_API FString Encode (const uint8 *Source, uint32 Length, EBase64Mode Mode=EBase64Mode::Standard)
 
template<typename CharType >
static CORE_API uint32 Encode (const uint8 *Source, uint32 Length, CharType *Dest, EBase64Mode Mode=EBase64Mode::Standard)
 
static constexpr uint32 GetEncodedDataSize (uint32 NumBytes)
 
static CORE_API bool Decode (const FString &Source, FString &OutDest, EBase64Mode Mode=EBase64Mode::Standard)
 
static CORE_API bool Decode (const FString &Source, TArray< uint8 > &Dest, EBase64Mode Mode=EBase64Mode::Standard)
 
template<typename CharType >
static CORE_API bool Decode (const CharType *Source, uint32 Length, uint8 *Dest, EBase64Mode Mode=EBase64Mode::Standard)
 
static CORE_API uint32 GetDecodedDataSize (const FString &Source)
 
template<typename CharType >
static CORE_API uint32 GetDecodedDataSize (const CharType *Source, uint32 Length)
 
static constexpr uint32 GetMaxDecodedDataSize (uint32 NumChars)
 

Detailed Description

Class for encoding/decoding Base64 data (RFC 4648)

Member Function Documentation

◆ Decode() [1/4]

template<typename CharType >
bool FBase64::Decode ( const CharType *  Source,
uint32  Length,
uint8 Dest,
EBase64Mode  Mode 
)

◆ Decode() [2/4]

template<typename CharType >
static CORE_API bool FBase64::Decode ( const CharType *  Source,
uint32  Length,
uint8 Dest,
EBase64Mode  Mode = EBase64Mode::Standard 
)
static

Decodes a Base64 string into a preallocated buffer

Parameters
SourceThe Base64 encoded string
LengthLength of the Base64 encoded string
DestBuffer to receive the decoded data. Must be large enough to contain the entire output data (see GetDecodedDataSize()). Can point to the same buffer as Source
ModeThe mode to use for decoding. Default is EBase64Mode::Standard
Returns
true if the buffer was decoded, false if it was invalid.

◆ Decode() [3/4]

bool FBase64::Decode ( const FString &  Source,
FString &  OutDest,
EBase64Mode  Mode = EBase64Mode::Standard 
)
static

Decodes a Base64 string into a FString

Parameters
SourceThe Base64 encoded string
OutDestReceives the decoded string data
ModeThe mode to use for decoding. Default is EBase64Mode::Standard
Returns
true if the buffer was decoded, false if it was invalid.

◆ Decode() [4/4]

bool FBase64::Decode ( const FString &  Source,
TArray< uint8 > &  Dest,
EBase64Mode  Mode = EBase64Mode::Standard 
)
static

Decodes a Base64 string into an array of bytes

Parameters
SourceThe Base64 encoded string
DestArray to receive the decoded data
ModeThe mode to use for decoding. Default is EBase64Mode::Standard
Returns
true if the buffer was decoded, false if it was invalid.

◆ Encode() [1/5]

FString FBase64::Encode ( const FString &  Source,
EBase64Mode  Mode = EBase64Mode::Standard 
)
static

Encodes a FString into a Base64 string

Parameters
SourceThe string data to convert
ModeThe mode to use for encoding. Default is EBase64Mode::Standard
Returns
A string that encodes the binary data in a way that can be safely transmitted via various Internet protocols

◆ Encode() [2/5]

FString FBase64::Encode ( const TArray< uint8 > &  Source,
EBase64Mode  Mode = EBase64Mode::Standard 
)
static

Encodes a binary uint8 array into a Base64 string

Parameters
SourceThe binary data to convert
ModeThe mode to use for encoding. Default is EBase64Mode::Standard
Returns
A string that encodes the binary data in a way that can be safely transmitted via various Internet protocols

◆ Encode() [3/5]

template<typename CharType >
uint32 FBase64::Encode ( const uint8 Source,
uint32  Length,
CharType *  Dest,
EBase64Mode  Mode 
)

◆ Encode() [4/5]

template<typename CharType >
static CORE_API uint32 FBase64::Encode ( const uint8 Source,
uint32  Length,
CharType *  Dest,
EBase64Mode  Mode = EBase64Mode::Standard 
)
static

Encodes the source into a Base64 string, storing it in a preallocated buffer.

Parameters
SourceThe binary data to encode
LengthLength of the binary data to be encoded
DestBuffer to receive the encoded data. Must be large enough to contain the entire output data (see GetEncodedDataSize()). Can point to the same buffer as Source
ModeThe mode to use for encoding. Default is EBase64Mode::Standard
Returns
The length of the encoded data

◆ Encode() [5/5]

FString FBase64::Encode ( const uint8 Source,
uint32  Length,
EBase64Mode  Mode = EBase64Mode::Standard 
)
static

Encodes the source into a Base64 string

Parameters
SourceThe binary data to encode
LengthLength of the binary data to be encoded
ModeThe mode to use for encoding. Default is EBase64Mode::Standard
Returns
Base64 encoded string containing the binary data.

◆ GetDecodedDataSize() [1/3]

template<typename CharType >
uint32 FBase64::GetDecodedDataSize ( const CharType *  Source,
uint32  Length 
)

◆ GetDecodedDataSize() [2/3]

template<typename CharType >
static CORE_API uint32 FBase64::GetDecodedDataSize ( const CharType *  Source,
uint32  Length 
)
static

Determine the decoded data size for the incoming base64 encoded string

Parameters
SourceThe Base64 encoded string
LengthLength of the Base64 encoded string
Returns
The size in bytes of the decoded data

◆ GetDecodedDataSize() [3/3]

uint32 FBase64::GetDecodedDataSize ( const FString &  Source)
static

Determine the decoded data size for the incoming base64 encoded string

Parameters
SourceThe Base64 encoded string
Returns
The size in bytes of the decoded data

◆ GetEncodedDataSize()

static constexpr uint32 FBase64::GetEncodedDataSize ( uint32  NumBytes)
inlinestaticconstexpr

Get the encoded data size for the given number of bytes.

Parameters
NumBytesThe number of bytes of input
Returns
The number of characters in the encoded data.

◆ GetMaxDecodedDataSize()

static constexpr uint32 FBase64::GetMaxDecodedDataSize ( uint32  NumChars)
inlinestaticconstexpr

Get the maximum decoded data size for the given number of input characters.

Parameters
LengthThe number of input characters.
Returns
The maximum number of bytes that can be decoded from this input stream. The actual number of characters decoded may be less if the data contains padding characters. Call GetDecodedDataSize() with the input data to find the exact length.

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