Documentation ¶
Index ¶
- func CalcSize(content interface{}) int
- type ByteStream
- func (bs *ByteStream) GetUsedSlice() []byte
- func (bs *ByteStream) Marshal(content interface{}) error
- func (bs *ByteStream) ReadBool() (bool, error)
- func (bs *ByteStream) ReadByte() (byte, error)
- func (bs *ByteStream) ReadBytes() ([]byte, error)
- func (bs *ByteStream) ReadEnd() bool
- func (bs *ByteStream) ReadFloat32() (float32, error)
- func (bs *ByteStream) ReadFloat64() (float64, error)
- func (bs *ByteStream) ReadInt16() (int16, error)
- func (bs *ByteStream) ReadInt32() (int32, error)
- func (bs *ByteStream) ReadInt64() (int64, error)
- func (bs *ByteStream) ReadInt8() (int8, error)
- func (bs *ByteStream) ReadStr() (string, error)
- func (bs *ByteStream) ReadUInt16() (uint16, error)
- func (bs *ByteStream) ReadUInt32() (uint32, error)
- func (bs *ByteStream) ReadUInt64() (uint64, error)
- func (bs *ByteStream) ReadVector3() (linmath.Vector3, error)
- func (bs *ByteStream) Unmarshal(content interface{}) error
- func (bs *ByteStream) WriteBool(v bool) error
- func (bs *ByteStream) WriteByte(v byte) error
- func (bs *ByteStream) WriteBytes(v []byte) error
- func (bs *ByteStream) WriteFloat32(f float32) error
- func (bs *ByteStream) WriteFloat64(f float64) error
- func (bs *ByteStream) WriteInt16(v int16) error
- func (bs *ByteStream) WriteInt32(v int32) error
- func (bs *ByteStream) WriteInt32AtPos(value int32, pos uint32)
- func (bs *ByteStream) WriteInt64(v int64) error
- func (bs *ByteStream) WriteInt8(v int8) error
- func (bs *ByteStream) WriteMap(val map[uint32]uint32) error
- func (bs *ByteStream) WriteStr(v string) error
- func (bs *ByteStream) WriteUInt16(v uint16) error
- func (bs *ByteStream) WriteUInt32(v uint32) error
- func (bs *ByteStream) WriteUInt64(v uint64) error
- func (bs *ByteStream) WriteVector3(pos linmath.Vector3) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ByteStream ¶
type ByteStream struct {
// contains filtered or unexported fields
}
ByteStream 包装一些字节流的读写方法,方便二进制消息的序列和反序列
func (*ByteStream) GetUsedSlice ¶
func (bs *ByteStream) GetUsedSlice() []byte
GetUsedSlice 获取已经写入的部分Slice
func (*ByteStream) Marshal ¶
func (bs *ByteStream) Marshal(content interface{}) error
Marshal 序列化content
func (*ByteStream) ReadBytes ¶
func (bs *ByteStream) ReadBytes() ([]byte, error)
ReadBytes 读取一个byte[]
func (*ByteStream) ReadFloat32 ¶
func (bs *ByteStream) ReadFloat32() (float32, error)
ReadFloat32 读取float32
func (*ByteStream) ReadFloat64 ¶
func (bs *ByteStream) ReadFloat64() (float64, error)
ReadFloat64 读取float64
func (*ByteStream) ReadUInt16 ¶
func (bs *ByteStream) ReadUInt16() (uint16, error)
ReadUInt16 读取一个UInt16
func (*ByteStream) ReadUInt32 ¶
func (bs *ByteStream) ReadUInt32() (uint32, error)
ReadUInt32 读取一个Int
func (*ByteStream) ReadUInt64 ¶
func (bs *ByteStream) ReadUInt64() (uint64, error)
ReadUInt64 读取一个Uint64
func (*ByteStream) ReadVector3 ¶
func (bs *ByteStream) ReadVector3() (linmath.Vector3, error)
ReadVector3 读取一个坐标
func (*ByteStream) Unmarshal ¶
func (bs *ByteStream) Unmarshal(content interface{}) error
Unmarshal 反序列化
func (*ByteStream) WriteBool ¶
func (bs *ByteStream) WriteBool(v bool) error
WriteBool 写bool, 1代表true, 0代表false
func (*ByteStream) WriteFloat32 ¶
func (bs *ByteStream) WriteFloat32(f float32) error
WriteFloat32 写Float32
func (*ByteStream) WriteFloat64 ¶
func (bs *ByteStream) WriteFloat64(f float64) error
WriteFloat64 写Float64
func (*ByteStream) WriteInt32AtPos ¶
func (bs *ByteStream) WriteInt32AtPos(value int32, pos uint32)
func (*ByteStream) WriteUInt16 ¶
func (bs *ByteStream) WriteUInt16(v uint16) error
WriteUInt16 写Uint16
func (*ByteStream) WriteUInt32 ¶
func (bs *ByteStream) WriteUInt32(v uint32) error
WriteUInt32 写Uint32
func (*ByteStream) WriteUInt64 ¶
func (bs *ByteStream) WriteUInt64(v uint64) error
WriteUInt64 写Uint64
func (*ByteStream) WriteVector3 ¶
func (bs *ByteStream) WriteVector3(pos linmath.Vector3) error
WriteVector3 写位置信息
Click to show internal directories.
Click to hide internal directories.