当前位置: 首页>>代码示例>>Golang>>正文


Golang Writer.WriteUint32方法代码示例

本文整理汇总了Golang中github.com/calmh/xdr.Writer.WriteUint32方法的典型用法代码示例。如果您正苦于以下问题:Golang Writer.WriteUint32方法的具体用法?Golang Writer.WriteUint32怎么用?Golang Writer.WriteUint32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/calmh/xdr.Writer的用法示例。


在下文中一共展示了Writer.WriteUint32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: EncodeXDRInto

func (o ClusterConfigMessage) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.ClientName); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("ClientName", l, 64)
	}
	xw.WriteString(o.ClientName)
	if l := len(o.ClientVersion); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("ClientVersion", l, 64)
	}
	xw.WriteString(o.ClientVersion)
	if l := len(o.Folders); l > 1000000 {
		return xw.Tot(), xdr.ElementSizeExceeded("Folders", l, 1000000)
	}
	xw.WriteUint32(uint32(len(o.Folders)))
	for i := range o.Folders {
		_, err := o.Folders[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	if l := len(o.Options); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
	}
	xw.WriteUint32(uint32(len(o.Options)))
	for i := range o.Options {
		_, err := o.Options[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
开发者ID:oliviercoma,项目名称:syncthing,代码行数:31,代码来源:message_xdr.go

示例2: EncodeXDRInto

func (o Device) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.ID); l > 32 {
		return xw.Tot(), xdr.ElementSizeExceeded("ID", l, 32)
	}
	xw.WriteBytes(o.ID)
	if l := len(o.Addresses); l > 16 {
		return xw.Tot(), xdr.ElementSizeExceeded("Addresses", l, 16)
	}
	xw.WriteUint32(uint32(len(o.Addresses)))
	for i := range o.Addresses {
		_, err := o.Addresses[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	if l := len(o.Relays); l > 16 {
		return xw.Tot(), xdr.ElementSizeExceeded("Relays", l, 16)
	}
	xw.WriteUint32(uint32(len(o.Relays)))
	for i := range o.Relays {
		_, err := o.Relays[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
开发者ID:wmwwmv,项目名称:syncthing,代码行数:27,代码来源:localpackets_xdr.go

示例3: encodeXDR

func (o addressList) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(uint32(len(o.addresses)))
	for i := range o.addresses {
		o.addresses[i].encodeXDR(xw)
	}
	return xw.Tot(), xw.Error()
}
开发者ID:mapleshadow,项目名称:discosrv,代码行数:7,代码来源:types_xdr.go

示例4: 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.Folders) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteUint32(uint32(len(o.Folders)))
	for i := range o.Folders {
		_, err := o.Folders[i].encodeXDR(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	if len(o.Options) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteUint32(uint32(len(o.Options)))
	for i := range o.Options {
		_, err := o.Options[i].encodeXDR(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
开发者ID:baa-archieve,项目名称:syncthing,代码行数:31,代码来源:message_xdr.go

示例5: EncodeXDRInto

func (o Relay) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.Address); l > 256 {
		return xw.Tot(), xdr.ElementSizeExceeded("Address", l, 256)
	}
	xw.WriteString(o.Address)
	xw.WriteUint32(uint32(o.Latency))
	return xw.Tot(), xw.Error()
}
开发者ID:rwx-zwx-awx,项目名称:syncthing,代码行数:8,代码来源:packets_xdr.go

示例6: EncodeXDRInto

func (o Query) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(o.Magic)
	if l := len(o.DeviceID); l > 32 {
		return xw.Tot(), xdr.ElementSizeExceeded("DeviceID", l, 32)
	}
	xw.WriteBytes(o.DeviceID)
	return xw.Tot(), xw.Error()
}
开发者ID:kattunga,项目名称:syncthing,代码行数:8,代码来源:packets_xdr.go

示例7: encodeXDR

func (o Query) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(o.Magic)
	if len(o.DeviceID) > 32 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteBytes(o.DeviceID)
	return xw.Tot(), xw.Error()
}
开发者ID:baa-archieve,项目名称:syncthing,代码行数:8,代码来源:packets_xdr.go

示例8: EncodeXDRInto

func (o versionList) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(uint32(len(o.versions)))
	for i := range o.versions {
		_, err := o.versions[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
开发者ID:kattunga,项目名称:syncthing,代码行数:10,代码来源:leveldb_xdr.go

示例9: encodeXDR

func (o RequestMessage) encodeXDR(xw *xdr.Writer) (int, error) {
	if l := len(o.Folder); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Folder", l, 64)
	}
	xw.WriteString(o.Folder)
	if l := len(o.Name); l > 8192 {
		return xw.Tot(), xdr.ElementSizeExceeded("Name", l, 8192)
	}
	xw.WriteString(o.Name)
	xw.WriteUint64(o.Offset)
	xw.WriteUint32(o.Size)
	return xw.Tot(), xw.Error()
}
开发者ID:ericcapricorn,项目名称:syncthing,代码行数:13,代码来源:message_xdr.go

示例10: EncodeXDRInto

func (o Device) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.ID); l > 32 {
		return xw.Tot(), xdr.ElementSizeExceeded("ID", l, 32)
	}
	xw.WriteBytes(o.ID)
	if l := len(o.Name); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Name", l, 64)
	}
	xw.WriteString(o.Name)
	if l := len(o.Addresses); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Addresses", l, 64)
	}
	xw.WriteUint32(uint32(len(o.Addresses)))
	for i := range o.Addresses {
		xw.WriteString(o.Addresses[i])
	}
	xw.WriteUint32(o.Compression)
	if l := len(o.CertName); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("CertName", l, 64)
	}
	xw.WriteString(o.CertName)
	xw.WriteUint64(uint64(o.MaxLocalVersion))
	xw.WriteUint32(o.Flags)
	if l := len(o.Options); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
	}
	xw.WriteUint32(uint32(len(o.Options)))
	for i := range o.Options {
		_, err := o.Options[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
开发者ID:modulexcite,项目名称:relaysrv,代码行数:35,代码来源:message_xdr.go

示例11: encodeXDR

func (o Repository) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.ID) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.ID)
	if len(o.Nodes) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteUint32(uint32(len(o.Nodes)))
	for i := range o.Nodes {
		_, err := o.Nodes[i].encodeXDR(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
开发者ID:Blueprint-Marketing,项目名称:syncthing,代码行数:17,代码来源:message_xdr.go

示例12: EncodeXDRInto

func (o XDRBenchStruct) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	xw.WriteUint64(o.I1)
	xw.WriteUint32(o.I2)
	xw.WriteUint16(o.I3)
	xw.WriteUint8(o.I4)
	if l := len(o.Bs0); l > 128 {
		return xw.Tot(), xdr.ElementSizeExceeded("Bs0", l, 128)
	}
	xw.WriteBytes(o.Bs0)
	xw.WriteBytes(o.Bs1)
	if l := len(o.S0); l > 128 {
		return xw.Tot(), xdr.ElementSizeExceeded("S0", l, 128)
	}
	xw.WriteString(o.S0)
	xw.WriteString(o.S1)
	return xw.Tot(), xw.Error()
}
开发者ID:kattunga,项目名称:syncthing,代码行数:17,代码来源:bench_xdr_test.go

示例13: encodeXDR

func (o XDRBenchStruct) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint64(o.I1)
	xw.WriteUint32(o.I2)
	xw.WriteUint16(o.I3)
	xw.WriteUint8(o.I4)
	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:GDXN,项目名称:syncthing,代码行数:17,代码来源:bench_xdr_test.go

示例14: encodeXDR

func (o TestStruct) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint64(uint64(o.I))
	xw.WriteUint8(uint8(o.I8))
	xw.WriteUint8(o.UI8)
	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)
	_, err := o.C.encodeXDR(xw)
	if err != nil {
		return xw.Tot(), err
	}
	return xw.Tot(), xw.Error()
}
开发者ID:Blueprint-Marketing,项目名称:syncthing,代码行数:18,代码来源:encdec_xdr_test.go

示例15: EncodeXDRInto

func (o FileInfo) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.Name); l > 8192 {
		return xw.Tot(), xdr.ElementSizeExceeded("Name", l, 8192)
	}
	xw.WriteString(o.Name)
	xw.WriteUint32(o.Flags)
	xw.WriteUint64(uint64(o.Modified))
	_, err := o.Version.EncodeXDRInto(xw)
	if err != nil {
		return xw.Tot(), err
	}
	xw.WriteUint64(uint64(o.LocalVersion))
	xw.WriteUint32(uint32(len(o.Blocks)))
	for i := range o.Blocks {
		_, err := o.Blocks[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
开发者ID:kattunga,项目名称:syncthing,代码行数:21,代码来源:message_xdr.go


注:本文中的github.com/calmh/xdr.Writer.WriteUint32方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。