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


Golang xdr.Reader类代码示例

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


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

示例1: DecodeXDRFrom

func (o *Device) DecodeXDRFrom(xr *xdr.Reader) error {
	o.ID = xr.ReadBytesMax(32)
	_AddressesSize := int(xr.ReadUint32())
	if _AddressesSize < 0 {
		return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 16)
	}
	if _AddressesSize > 16 {
		return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 16)
	}
	o.Addresses = make([]string, _AddressesSize)
	for i := range o.Addresses {
		o.Addresses[i] = xr.ReadString()
	}
	_RelaysSize := int(xr.ReadUint32())
	if _RelaysSize < 0 {
		return xdr.ElementSizeExceeded("Relays", _RelaysSize, 16)
	}
	if _RelaysSize > 16 {
		return xdr.ElementSizeExceeded("Relays", _RelaysSize, 16)
	}
	o.Relays = make([]Relay, _RelaysSize)
	for i := range o.Relays {
		(&o.Relays[i]).DecodeXDRFrom(xr)
	}
	return xr.Error()
}
开发者ID:rwx-zwx-awx,项目名称:syncthing,代码行数:26,代码来源:packets_xdr.go

示例2: decodeXDR

func (o *RequestMessage) decodeXDR(xr *xdr.Reader) error {
	o.Repository = xr.ReadStringMax(64)
	o.Name = xr.ReadStringMax(1024)
	o.Offset = xr.ReadUint64()
	o.Size = xr.ReadUint32()
	return xr.Error()
}
开发者ID:Blueprint-Marketing,项目名称:syncthing,代码行数:7,代码来源:message_xdr.go

示例3: DecodeXDRFrom

func (o *ClusterConfigMessage) DecodeXDRFrom(xr *xdr.Reader) error {
	o.ClientName = xr.ReadStringMax(64)
	o.ClientVersion = xr.ReadStringMax(64)
	_FoldersSize := int(xr.ReadUint32())
	if _FoldersSize < 0 {
		return xdr.ElementSizeExceeded("Folders", _FoldersSize, 1000000)
	}
	if _FoldersSize > 1000000 {
		return xdr.ElementSizeExceeded("Folders", _FoldersSize, 1000000)
	}
	o.Folders = make([]Folder, _FoldersSize)
	for i := range o.Folders {
		(&o.Folders[i]).DecodeXDRFrom(xr)
	}
	_OptionsSize := int(xr.ReadUint32())
	if _OptionsSize < 0 {
		return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
	}
	if _OptionsSize > 64 {
		return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
	}
	o.Options = make([]Option, _OptionsSize)
	for i := range o.Options {
		(&o.Options[i]).DecodeXDRFrom(xr)
	}
	return xr.Error()
}
开发者ID:oliviercoma,项目名称:syncthing,代码行数:27,代码来源:message_xdr.go

示例4: decodeXDR

func (o *RequestMessage) decodeXDR(xr *xdr.Reader) error {
	o.Folder = xr.ReadStringMax(64)
	o.Name = xr.ReadStringMax(8192)
	o.Offset = xr.ReadUint64()
	o.Size = xr.ReadUint32()
	return xr.Error()
}
开发者ID:baa-archieve,项目名称:syncthing,代码行数:7,代码来源:message_xdr.go

示例5: decodeXDR

func (o *versionList) decodeXDR(xr *xdr.Reader) error {
	_versionsSize := int(xr.ReadUint32())
	o.versions = make([]fileVersion, _versionsSize)
	for i := range o.versions {
		(&o.versions[i]).decodeXDR(xr)
	}
	return xr.Error()
}
开发者ID:qbit,项目名称:syncthing,代码行数:8,代码来源:leveldb_xdr.go

示例6: decodeXDR

func (o *addressList) decodeXDR(xr *xdr.Reader) error {
	_addressesSize := int(xr.ReadUint32())
	o.addresses = make([]address, _addressesSize)
	for i := range o.addresses {
		(&o.addresses[i]).decodeXDR(xr)
	}
	return xr.Error()
}
开发者ID:mapleshadow,项目名称:discosrv,代码行数:8,代码来源:types_xdr.go

示例7: DecodeXDRFrom

func (o *versionList) DecodeXDRFrom(xr *xdr.Reader) error {
	_versionsSize := int(xr.ReadUint32())
	if _versionsSize < 0 {
		return xdr.ElementSizeExceeded("versions", _versionsSize, 0)
	}
	o.versions = make([]fileVersion, _versionsSize)
	for i := range o.versions {
		(&o.versions[i]).DecodeXDRFrom(xr)
	}
	return xr.Error()
}
开发者ID:kattunga,项目名称:syncthing,代码行数:11,代码来源:leveldb_xdr.go

示例8: decodeXDR

func (o *Folder) decodeXDR(xr *xdr.Reader) error {
	o.ID = xr.ReadStringMax(64)
	_DevicesSize := int(xr.ReadUint32())
	o.Devices = make([]Device, _DevicesSize)
	for i := range o.Devices {
		(&o.Devices[i]).decodeXDR(xr)
	}
	return xr.Error()
}
开发者ID:ericcapricorn,项目名称:syncthing,代码行数:9,代码来源:message_xdr.go

示例9: decodeXDR

func (o *Device) decodeXDR(xr *xdr.Reader) error {
	o.ID = xr.ReadBytesMax(32)
	_AddressesSize := int(xr.ReadUint32())
	if _AddressesSize > 16 {
		return xdr.ErrElementSizeExceeded
	}
	o.Addresses = make([]Address, _AddressesSize)
	for i := range o.Addresses {
		(&o.Addresses[i]).decodeXDR(xr)
	}
	return xr.Error()
}
开发者ID:baa-archieve,项目名称:syncthing,代码行数:12,代码来源:packets_xdr.go

示例10: DecodeXDRFrom

func (o *JoinSessionRequest) DecodeXDRFrom(xr *xdr.Reader) error {
	o.Key = xr.ReadBytesMax(32)
	return xr.Error()
}
开发者ID:readthecodes,项目名称:syncthing,代码行数:4,代码来源:packets_xdr.go

示例11: decodeXDR

func (h *header) decodeXDR(xr *xdr.Reader) error {
	u := xr.ReadUint32()
	*h = decodeHeader(u)
	return xr.Error()
}
开发者ID:kattunga,项目名称:syncthing,代码行数:5,代码来源:header.go


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