Variant 類別
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
protobuf
傳輸格式使用 Variant 類別來決定單一資料的傳輸方式。其他格式也可能使用;詳情請參閱「通訊協定緩衝區編碼」。
Variant
由 protorpc.messages
模組提供。
Variant 的值如下:
BOOL
- 布林值 (True 或 False)
BYTES
- 8 位元位元組的字串。
DOUBLE
- 64 位元浮點數。
ENUM
- 列舉值 (整數)。
FLOAT
- 32 位元浮點數。
INT32
- 32 位元帶正負號整數。
INT64
- 64 位元帶正負號整數。
MESSAGE
- 以位元組字串形式嵌入訊息。
SINT32
- 32 位元帶正負號整數。使用 ZigZag 編碼。
SINT64
- 64 位元帶正負號整數。使用 ZigZag 編碼。
STRING
- UTF-8 編碼文字的字串。
UINT32
- 32 位元不帶正負號整數。
UINT64
- 64 位元無正負號整數。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-08 (世界標準時間)。
[[["容易理解","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-08 (世界標準時間)。"],[[["The `protobuf` wire format utilizes the `Variant` class to define data transmission."],["`Variant`, found in the `protorpc.messages` module, specifies the type of data being transmitted."],["`Variant` supports various data types, including boolean, byte strings, floating-point numbers, enums, integers, and embedded messages."],["`Variant` can utilize ZigZag encoding for signed integers using `SINT32` and `SINT64` types."],["`STRING` type is used for UTF-8 encoded text."]]],[]]