Set of functions for working with data serialization and writing data to disk.
More...
#include <DataSerializerLib.h>
|
static bool | WriteBytesToDisk (const TArray< uint8 > &InBytes, FString InPath) |
|
static bool | WriteBytesToDiskCompressed (const TArray< uint8 > &InBytes, FString InPath) |
|
static bool | ReadBytesFromDisk (TArray< uint8 > &OutBytes, FString InPath) |
|
static bool | ReadCompressedBytesFromDisk (TArray< uint8 > &OutBytes, FString InPath) |
|
static bool | SerializeObject (TArray< uint8 > &OutBytes, UObject *InObject) |
|
static bool | DeserializeObject (const TArray< uint8 > &InBytes, UObject *ObjectOuter, UObject *&OutObject) |
|
static bool | DeSerializeObjectCpp (FMemoryReader &InReader, UObject *ObjectOuter, UObject *&OutObject) |
|
static bool | SerializeObjects (TArray< uint8 > &OutBytes, TArray< UObject * > InObjects) |
|
static bool | DeSerializeObjects (const TArray< uint8 > &InBytes, UObject *InObjectOuter, TArray< UObject * > &OutObjects) |
|
static bool | DeSerializeObjectsCpp (FMemoryReader &InReader, UObject *InObjectOuter, TArray< UObject * > &OutObjects) |
|
static void | GetUtf8Bytes (const FString &InString, TArray< uint8 > &OutBytes) |
|
static FString | Utf8BytesToString (const TArray< uint8 > &InBytes) |
|
static TArray< uint8 > | AppendBytes (const TArray< uint8 > &InLeftPart, const TArray< uint8 > &InRightPart) |
|
Set of functions for working with data serialization and writing data to disk.
◆ AppendBytes()
static TArray< uint8 > UDataSerializerLib::AppendBytes |
( |
const TArray< uint8 > & | InLeftPart, |
|
|
const TArray< uint8 > & | InRightPart ) |
|
static |
Concatenates two byte arrays into one.
This function takes two byte arrays InLeftPart
and InRightPart
and combines them into a single byte array. The resulting byte array contains the data from InLeftPart
followed by the data from InRightPart
.
- Parameters
-
InLeftPart | The first byte array to be concatenated. |
InRightPart | The second byte array to be concatenated. |
- Returns
- Returns a new byte array that is the concatenation of
InLeftPart
and InRightPart
.
◆ DeserializeObject()
static bool UDataSerializerLib::DeserializeObject |
( |
const TArray< uint8 > & | InBytes, |
|
|
UObject * | ObjectOuter, |
|
|
UObject *& | OutObject ) |
|
static |
Deserializes a byte array into an object.
This function converts the byte array InBytes
into an object of type UObject
and assigns it to OutObject
. The deserialization process reconstructs the object from the byte array.
- Parameters
-
InBytes | The byte array containing the serialized object data. |
ObjectOuter | The outer object for the deserialization process. This can be used to specify an outer context for the deserialized object. |
OutObject | The object that will be populated with the deserialized data. |
- Returns
- Returns true if the deserialization was successful, otherwise false.
◆ DeSerializeObjects()
static bool UDataSerializerLib::DeSerializeObjects |
( |
const TArray< uint8 > & | InBytes, |
|
|
UObject * | InObjectOuter, |
|
|
TArray< UObject * > & | OutObjects ) |
|
static |
Deserializes a byte array into multiple objects.
This function converts the byte array InBytes
into an array of objects and assigns them to OutObjects
. The byte array should contain serialized data for multiple objects in sequence.
- Parameters
-
InBytes | The byte array containing the serialized objects data. |
InObjectOuter | The outer object for the deserialization process. This can be used to specify an outer context for the deserialized objects. |
OutObjects | The array that will be populated with the deserialized objects. |
- Returns
- Returns true if the deserialization was successful, otherwise false.
◆ GetUtf8Bytes()
static void UDataSerializerLib::GetUtf8Bytes |
( |
const FString & | InString, |
|
|
TArray< uint8 > & | OutBytes ) |
|
static |
Converts a string into a UTF-8 byte array.
This function takes a string InString
and converts it into a byte array using UTF-8 encoding. The resulting byte array is stored in OutBytes
.
- Parameters
-
InString | The string to be converted into a UTF-8 byte array. |
OutBytes | The byte array that will be populated with the UTF-8 encoded data. |
◆ ReadBytesFromDisk()
static bool UDataSerializerLib::ReadBytesFromDisk |
( |
TArray< uint8 > & | OutBytes, |
|
|
FString | InPath ) |
|
static |
Reads a byte array from a file on disk.
This function reads the contents of the file specified by InPath
into the OutBytes
array. The file must exist and be readable for this operation to succeed.
- Parameters
-
OutBytes | The byte array that will be populated with the data read from the file. |
InPath | The path to the file from which the byte array should be read. |
- Returns
- Returns true if the operation was successful, otherwise false.
◆ ReadCompressedBytesFromDisk()
static bool UDataSerializerLib::ReadCompressedBytesFromDisk |
( |
TArray< uint8 > & | OutBytes, |
|
|
FString | InPath ) |
|
static |
Reads a compressed byte array from a file on disk and decompresses it.
This function reads the compressed contents of the file specified by InPath
into the OutBytes
array after decompressing it. The file must exist and be readable for this operation to succeed.
- Parameters
-
OutBytes | The byte array that will be populated with the decompressed data read from the file. |
InPath | The path to the file from which the compressed byte array should be read and decompressed. |
- Returns
- Returns true if the operation was successful, otherwise false.
◆ SerializeObject()
static bool UDataSerializerLib::SerializeObject |
( |
TArray< uint8 > & | OutBytes, |
|
|
UObject * | InObject ) |
|
static |
Serializes an object into a byte array.
This function converts the given InObject
into a byte array and populates OutBytes
with the serialized data. The serialization process converts the object into a format that can be easily stored or transmitted.
- Parameters
-
OutBytes | The byte array that will be populated with the serialized object data. |
InObject | The object to be serialized. |
- Returns
- Returns true if the serialization was successful, otherwise false.
◆ SerializeObjects()
static bool UDataSerializerLib::SerializeObjects |
( |
TArray< uint8 > & | OutBytes, |
|
|
TArray< UObject * > | InObjects ) |
|
static |
Serializes multiple objects into a byte array.
This function converts the array of objects InObjects
into a byte array and populates OutBytes
with the serialized data. Each object is serialized in sequence and combined into a single byte array.
- Parameters
-
OutBytes | The byte array that will be populated with the serialized objects data. |
InObjects | The array of objects to be serialized. |
- Returns
- Returns true if the serialization was successful, otherwise false.
◆ Utf8BytesToString()
static FString UDataSerializerLib::Utf8BytesToString |
( |
const TArray< uint8 > & | InBytes | ) |
|
|
static |
Converts a UTF-8 byte array back into a string.
This function takes a byte array InBytes
encoded in UTF-8 and converts it back into a string.
- Parameters
-
InBytes | The byte array containing UTF-8 encoded data to be converted into a string. |
- Returns
- Returns the string representation of the UTF-8 encoded byte array.
◆ WriteBytesToDisk()
static bool UDataSerializerLib::WriteBytesToDisk |
( |
const TArray< uint8 > & | InBytes, |
|
|
FString | InPath ) |
|
static |
Writes a byte array to a file on disk.
This function writes the contents of the provided InBytes
array to a file specified by InPath
. The file will be created if it does not exist, or overwritten if it does.
- Parameters
-
InBytes | The byte array to be written to the file. |
InPath | The path to the file where the byte array should be written. |
- Returns
- Returns true if the operation was successful, otherwise false.
◆ WriteBytesToDiskCompressed()
static bool UDataSerializerLib::WriteBytesToDiskCompressed |
( |
const TArray< uint8 > & | InBytes, |
|
|
FString | InPath ) |
|
static |
Writes a compressed byte array to a file on disk.
This function first compresses the provided InBytes
array and then writes the compressed data to a file specified by InPath
. The file will be created if it does not exist, or overwritten if it does.
- Parameters
-
InBytes | The byte array to be compressed and written to the file. |
InPath | The path to the file where the compressed byte array should be written. |
- Returns
- Returns true if the operation was successful, otherwise false.
The documentation for this class was generated from the following file: