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


Golang Writer.WriteUint32方法代碼示例

本文整理匯總了Golang中github.com/calmh/syncthing/xdr.Writer.WriteUint32方法的典型用法代碼示例。如果您正苦於以下問題:Golang Writer.WriteUint32方法的具體用法?Golang Writer.WriteUint32怎麽用?Golang Writer.WriteUint32使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/calmh/syncthing/xdr.Writer的用法示例。


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

示例1: encodeXDR

func (o versionList) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(uint32(len(o.versions)))
	for i := range o.versions {
		o.versions[i].encodeXDR(xw)
	}
	return xw.Tot(), xw.Error()
}
開發者ID:jjoergensen,項目名稱:syncthing,代碼行數:7,代碼來源:leveldb_xdr.go

示例2: encodeXDR

func (o ClusterConfigMessage) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.ClientName) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.ClientName)
	if len(o.ClientVersion) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.ClientVersion)
	if len(o.Repositories) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteUint32(uint32(len(o.Repositories)))
	for i := range o.Repositories {
		o.Repositories[i].encodeXDR(xw)
	}
	if len(o.Options) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteUint32(uint32(len(o.Options)))
	for i := range o.Options {
		o.Options[i].encodeXDR(xw)
	}
	return xw.Tot(), xw.Error()
}
開發者ID:jjoergensen,項目名稱:syncthing,代碼行數:25,代碼來源:message_xdr.go

示例3: encodeXDR

func (o Node) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.ID) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.ID)
	xw.WriteUint32(o.Flags)
	return xw.Tot(), xw.Error()
}
開發者ID:nbrownus,項目名稱:syncthing,代碼行數:8,代碼來源:message_xdr.go

示例4: encodeXDR

func (o QueryV2) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(o.Magic)
	if len(o.NodeID) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.NodeID)
	return xw.Tot(), xw.Error()
}
開發者ID:nbrownus,項目名稱:syncthing,代碼行數:8,代碼來源:packets_xdr.go

示例5: encodeXDR

func (o OptionsMessage) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.Options) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteUint32(uint32(len(o.Options)))
	for i := range o.Options {
		o.Options[i].encodeXDR(xw)
	}
	return xw.Tot(), xw.Error()
}
開發者ID:ngpestelos,項目名稱:syncthing,代碼行數:10,代碼來源:message_xdr.go

示例6: encodeXDR

func (o IndexMessage) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.Repository) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.Repository)
	xw.WriteUint32(uint32(len(o.Files)))
	for i := range o.Files {
		o.Files[i].encodeXDR(xw)
	}
	return xw.Tot(), xw.Error()
}
開發者ID:retgoat,項目名稱:syncthing,代碼行數:11,代碼來源:message_xdr.go

示例7: encodeXDR

func (o TestStruct) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint64(uint64(o.I))
	xw.WriteUint16(uint16(o.I16))
	xw.WriteUint16(o.UI16)
	xw.WriteUint32(uint32(o.I32))
	xw.WriteUint32(o.UI32)
	xw.WriteUint64(uint64(o.I64))
	xw.WriteUint64(o.UI64)
	xw.WriteBytes(o.BS)
	xw.WriteString(o.S)
	return xw.Tot(), xw.Error()
}
開發者ID:KayoticSully,項目名稱:syncthing,代碼行數:12,代碼來源:encdec_xdr_test.go

示例8: encodeXDR

func (o AnnounceV2) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(o.Magic)
	o.This.encodeXDR(xw)
	if len(o.Extra) > 16 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteUint32(uint32(len(o.Extra)))
	for i := range o.Extra {
		o.Extra[i].encodeXDR(xw)
	}
	return xw.Tot(), xw.Error()
}
開發者ID:BillTheBest,項目名稱:syncthing,代碼行數:12,代碼來源:packets_xdr.go

示例9: encodeXDR

func (o File) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteString(o.Name)
	xw.WriteUint32(o.Flags)
	xw.WriteUint64(uint64(o.Modified))
	xw.WriteUint64(o.Version)
	xw.WriteUint64(uint64(o.Size))
	xw.WriteUint32(uint32(len(o.Blocks)))
	for i := range o.Blocks {
		o.Blocks[i].encodeXDR(xw)
	}
	xw.WriteBool(o.Suppressed)
	return xw.Tot(), xw.Error()
}
開發者ID:jjoergensen,項目名稱:syncthing,代碼行數:13,代碼來源:file_xdr.go

示例10: encodeXDR

func (o AnnounceV1) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(o.Magic)
	xw.WriteUint16(o.Port)
	if len(o.NodeID) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.NodeID)
	if len(o.IP) > 16 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteBytes(o.IP)
	return xw.Tot(), xw.Error()
}
開發者ID:ngpestelos,項目名稱:syncthing,代碼行數:13,代碼來源:packets_xdr.go

示例11: encodeXDR

func (o XDRBenchStruct) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint64(o.I1)
	xw.WriteUint32(o.I2)
	xw.WriteUint16(o.I3)
	if len(o.Bs0) > 128 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteBytes(o.Bs0)
	xw.WriteBytes(o.Bs1)
	if len(o.S0) > 128 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.S0)
	xw.WriteString(o.S1)
	return xw.Tot(), xw.Error()
}
開發者ID:BenKoerber,項目名稱:syncthing,代碼行數:16,代碼來源:bench_xdr_test.go

示例12: encodeXDR

func (h header) encodeXDR(xw *xdr.Writer) (int, error) {
	u := encodeHeader(h)
	return xw.WriteUint32(u)
}
開發者ID:retgoat,項目名稱:syncthing,代碼行數:4,代碼來源:header.go

示例13: encodeXDR

func (o Block) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint64(uint64(o.Offset))
	xw.WriteUint32(o.Size)
	xw.WriteBytes(o.Hash)
	return xw.Tot(), xw.Error()
}
開發者ID:jjoergensen,項目名稱:syncthing,代碼行數:6,代碼來源:blocks_xdr.go


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