Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
Marshalls
继承: Object
数据转换(marshalling)和编码辅助工具。
描述
提供进行数据转换和编码的实用函数。
方法
base64_to_raw(base64_str: String) |
|
base64_to_utf8(base64_str: String) |
|
base64_to_variant(base64_str: String, allow_objects: bool = false) |
|
raw_to_base64(array: PackedByteArray) |
|
utf8_to_base64(utf8_str: String) |
|
variant_to_base64(variant: Variant, full_objects: bool = false) |
方法说明
PackedByteArray base64_to_raw(base64_str: String) 🔗
返回与 Base64 编码字符串 base64_str
相对应的解码 PackedByteArray。
String base64_to_utf8(base64_str: String) 🔗
返回与 Base64 编码字符串 base64_str
相对应的解码字符串。
Variant base64_to_variant(base64_str: String, allow_objects: bool = false) 🔗
返回与 Base64 编码字符串 base64_str
相对应的解码 Variant。如果 allow_objects
为 true
,则允许对对象进行解码。
内部实现时,使用的解码机制与 @GlobalScope.bytes_to_var() 方法相同。
警告:反序列化的对象可能包含会被执行的代码。如果序列化的对象来自不受信任的来源,请不要使用这个选项,以避免潜在的安全威胁,如远程代码执行。
String raw_to_base64(array: PackedByteArray) 🔗
返回给定 PackedByteArray 的 Base64 编码的字符串。
String utf8_to_base64(utf8_str: String) 🔗
返回 UTF-8 字符串 utf8_str
的 Base64 编码的字符串。
String variant_to_base64(variant: Variant, full_objects: bool = false) 🔗
返回经过 Base64 编码的 Variant variant
的字符串。如果 full_objects
为 true
,则允许将对象进行编码(有可能包括代码)。
内部实现时,使用的编码机制与 @GlobalScope.var_to_bytes() 方法相同。