當前位置: 首頁>>代碼示例>>Golang>>正文


Golang bytes2.ChunkedWriter類代碼示例

本文整理匯總了Golang中git/masontest/com/branches/gomysqlproxy/app/models/bytes2.ChunkedWriter的典型用法代碼示例。如果您正苦於以下問題:Golang ChunkedWriter類的具體用法?Golang ChunkedWriter怎麽用?Golang ChunkedWriter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ChunkedWriter類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: EncodeString

// EncodeString encodes a string.
func EncodeString(buf *bytes2.ChunkedWriter, key string, val string) {
	// Encode strings as binary; go strings are not necessarily unicode
	EncodePrefix(buf, Binary, key)
	putUint32(buf, uint32(len(val)))
	buf.WriteByte(0)
	buf.WriteString(val)
}
開發者ID:nangong92t,項目名稱:go_src,代碼行數:8,代碼來源:marshal.go

示例2: EncodeBool

// EncodeBool encodes a bool.
func EncodeBool(buf *bytes2.ChunkedWriter, key string, val bool) {
	EncodePrefix(buf, Boolean, key)
	if val {
		buf.WriteByte(1)
	} else {
		buf.WriteByte(0)
	}
}
開發者ID:nangong92t,項目名稱:go_src,代碼行數:9,代碼來源:marshal.go

示例3: putUint64

func putUint64(buf *bytes2.ChunkedWriter, val uint64) {
	Pack.PutUint64(buf.Reserve(WORD64), val)
}
開發者ID:nangong92t,項目名稱:go_src,代碼行數:3,代碼來源:marshal.go

示例4: putUint32

func putUint32(buf *bytes2.ChunkedWriter, val uint32) {
	Pack.PutUint32(buf.Reserve(WORD32), val)
}
開發者ID:nangong92t,項目名稱:go_src,代碼行數:3,代碼來源:marshal.go

示例5: NewLenWriter

// NewLenWriter returns a LenWriter that reserves the
// bytes buf so they can store the length later.
func NewLenWriter(buf *bytes2.ChunkedWriter) LenWriter {
	off := buf.Len()
	b := buf.Reserve(WORD32)
	return LenWriter{buf, off, b}
}
開發者ID:nangong92t,項目名稱:go_src,代碼行數:7,代碼來源:marshal.go

示例6: EncodeBinary

// EncodeBinary encodes a []byte as binary.
func EncodeBinary(buf *bytes2.ChunkedWriter, key string, val []byte) {
	EncodePrefix(buf, Binary, key)
	putUint32(buf, uint32(len(val)))
	buf.WriteByte(0)
	buf.Write(val)
}
開發者ID:nangong92t,項目名稱:go_src,代碼行數:7,代碼來源:marshal.go

示例7: EncodePrefix

// EncodePrefix encodes key as prefix for the next object or value.
func EncodePrefix(buf *bytes2.ChunkedWriter, etype byte, key string) {
	b := buf.Reserve(len(key) + 2)
	b[0] = etype
	copy(b[1:], key)
	b[len(b)-1] = 0
}
開發者ID:nangong92t,項目名稱:go_src,代碼行數:7,代碼來源:marshal.go


注:本文中的git/masontest/com/branches/gomysqlproxy/app/models/bytes2.ChunkedWriter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。