コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
bytes.to_base64
bytes.to_base64(bytes, optional_default_string)
説明
関数は bytes
値を base64 encoded string
に変換します。キャストできない値を含む関数呼び出しは、デフォルトで空の文字列を返します。
パラメータのデータ型
BYTES
、STRING
戻り値の型
STRING
コードサンプル
未加工のバイナリ バイトから Base64 エンコードされた文字列
この関数は、未加工のバイナリ バイトを Base64 でエンコードされた文字列に変換します。
bytes.to_base64(b'000000006f8ec5586d026f9ddac56e9f2fe15b8a0000000001000000cd000000) = "AAAAAG+OxVhtAm+d2sVuny/hW4oAAAAAAQAAAM0AAAA="
変換の失敗(デフォルトはオプションで指定された文字列)
指定されたバイト値が無効な場合、関数はデフォルトで "invalid bytes"
になります。
bytes.to_base64(b'000000006f8ec5586d", "invalid bytes") = "invalid bytes"
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-29 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-29 UTC。"],[],[],null,["### bytes.to_base64\n\nSupported in: \n[Rules](/chronicle/docs/detection/default-rules) [Search](/chronicle/docs/investigation/udm-search) \n\n bytes.to_base64(bytes, optional_default_string)\n\n#### Description\n\nFunction converts a `bytes` value to a `base64 encoded string`. Function calls with values that cannot be casted return an empty string by default.\n\n#### Param data types\n\n`BYTES`, `STRING`\n\n#### Return type\n\n`STRING`\n\n#### Code samples\n\n##### Raw Binary Bytes to Base64 Encoded String\n\nThe function converts the raw binary bytes to base64 encoded string. \n\n bytes.to_base64(b'000000006f8ec5586d026f9ddac56e9f2fe15b8a0000000001000000cd000000) = \"AAAAAG+OxVhtAm+d2sVuny/hW4oAAAAAAQAAAM0AAAA=\"\n\n##### Failed Conversion (Defaults to the Optionally Provided String)\n\nThe function defaults to the `\"invalid bytes\"` when the bytes value provided isn't valid. \n\n bytes.to_base64(b'000000006f8ec5586d\", \"invalid bytes\") = \"invalid bytes\""]]