NewWriter 构造函数
buf
为初始写入的数据。
Simple 字段
同上面的 simple
参数。
Reset 方法
- func (w *Writer) Reset()
将序列化的引用计数器重置。
Serialize 方法
- func (w *Writer) Serialize(v interface{}) *Writer
序列化数据 v
。其中 v
为任意 hprose 支持的类型。
WriteBigFloat 方法
- func (w *Writer) WriteBigFloat(bf *big.Float)
序列化一个 *big.Float
数据,以浮点数方式序列化。
WriteBigInt 方法
序列化一个 *big.Int
数据,以长整数类型序列化。
WriteBigRat 方法
- func (w *Writer) WriteBigRat(br *big.Rat)
WriteBool 方法
- func (w *Writer) WriteBool(b bool)
序列化一个 bool
类型数据。
WriteBytes 方法
序列化一个 类型数据,以二进制串类型数据序列化。
WriteComplex128 方法
- func (w *Writer) WriteComplex128(c complex128)
序列化一个 complex128
类型数据。如果虚部为 0
,则按照浮点数类型序列化,否则按照包含两个浮点数的元素的数组序列化。
WriteComplex64 方法
- func (w *Writer) WriteComplex64(c complex64)
序列化一个 complex64
类型数据。如果虚部为 0
,则按照浮点数类型序列化,否则按照包含两个浮点数的元素的数组序列化。
WriteFloat 方法
- func (w *Writer) WriteFloat(f float64, bitSize int)
序列化一个浮点数。如果 f
原本是 float32
,bitSize
的值为 32
,否则 bitSize
的值为 64
。
WriteInt 方法
- func (w *Writer) WriteInt(i int64)
序列化一个整数 i
。如果 在 int32
的范围内,则按照 hprose 的整数类型序列化,否则按照 hprose 的长整数类型序列化。
WriteList 方法
- func (w *Writer) WriteList(lst *list.List)
WriteNil 方法
- func (w *Writer) WriteNil()
序列化一个 nil
值。按照 hprose 的 Null 类型序列化。
WriteSlice 方法
序列化一个 []reflect.Value
类型的数据,按照 hprose 的数组列表类型序列化。
WriteString 方法
- func (w *Writer) WriteString(str string)
序列化一个 string
类型的数据。如果 str 是 UTF8 编码,则按照字符串序列化,否则按照二进制串序列化。
WriteStringSlice 方法
- func (w *Writer) WriteStringSlice(slice []string)
序列化一个 []string
类型的数据。序列化为 hprose 的数组列表类型。
WriteTime 方法
- func (w *Writer) WriteTime(t *time.Time)
序列化一个 *time.Time
类型的数据。按照 hprose 的日期,时间或者日期时间类型序列化。
WriteTuple 方法
- func (w *Writer) WriteTuple(tuple ...interface{})
将多个数据按照 hprose 的数组列表类型序列化。
WriteUint 方法
WriteValue 方法
- func (w *Writer) WriteValue(v reflect.Value)
序列化一个 reflect.Value
类型的数据。