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


Golang Reader.ReadBytesMax方法代碼示例

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


在下文中一共展示了Reader.ReadBytesMax方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: DecodeXDRFrom

func (o *TestStruct) DecodeXDRFrom(xr *xdr.Reader) error {
	o.I = int(xr.ReadUint64())
	o.I8 = int8(xr.ReadUint8())
	o.UI8 = xr.ReadUint8()
	o.I16 = int16(xr.ReadUint16())
	o.UI16 = xr.ReadUint16()
	o.I32 = int32(xr.ReadUint32())
	o.UI32 = xr.ReadUint32()
	o.I64 = int64(xr.ReadUint64())
	o.UI64 = xr.ReadUint64()
	o.BS = xr.ReadBytesMax(1024)
	o.S = xr.ReadStringMax(1024)
	(&o.C).DecodeXDRFrom(xr)
	_SSSize := int(xr.ReadUint32())
	if _SSSize < 0 {
		return xdr.ElementSizeExceeded("SS", _SSSize, 1024)
	}
	if _SSSize > 1024 {
		return xdr.ElementSizeExceeded("SS", _SSSize, 1024)
	}
	o.SS = make([]string, _SSSize)
	for i := range o.SS {
		o.SS[i] = xr.ReadString()
	}
	return xr.Error()
}
開發者ID:kattunga,項目名稱:syncthing,代碼行數:26,代碼來源:encdec_xdr_test.go

示例3: DecodeXDRFrom

func (o *Device) DecodeXDRFrom(xr *xdr.Reader) error {
	o.ID = xr.ReadBytesMax(32)
	o.Name = xr.ReadStringMax(64)
	_AddressesSize := int(xr.ReadUint32())
	if _AddressesSize < 0 {
		return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 64)
	}
	if _AddressesSize > 64 {
		return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 64)
	}
	o.Addresses = make([]string, _AddressesSize)
	for i := range o.Addresses {
		o.Addresses[i] = xr.ReadStringMax(2083)
	}
	o.Compression = xr.ReadUint32()
	o.CertName = xr.ReadStringMax(64)
	o.MaxLocalVersion = int64(xr.ReadUint64())
	o.Flags = xr.ReadUint32()
	_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:modulexcite,項目名稱:relaysrv,代碼行數:31,代碼來源:message_xdr.go

示例4: DecodeXDRFrom

func (o *XDRBenchStruct) DecodeXDRFrom(xr *xdr.Reader) error {
	o.I1 = xr.ReadUint64()
	o.I2 = xr.ReadUint32()
	o.I3 = xr.ReadUint16()
	o.I4 = xr.ReadUint8()
	o.Bs0 = xr.ReadBytesMax(128)
	o.Bs1 = xr.ReadBytes()
	o.S0 = xr.ReadStringMax(128)
	o.S1 = xr.ReadString()
	return xr.Error()
}
開發者ID:kattunga,項目名稱:syncthing,代碼行數:11,代碼來源:bench_xdr_test.go

示例5: 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

示例6: DecodeXDRFrom

func (o *Device) DecodeXDRFrom(xr *xdr.Reader) error {
	o.ID = xr.ReadBytesMax(32)
	o.MaxLocalVersion = int64(xr.ReadUint64())
	o.Flags = xr.ReadUint32()
	_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,代碼行數:17,代碼來源:message_xdr.go

示例7: decodeXDR

func (o *RequestMessage) decodeXDR(xr *xdr.Reader) error {
	o.Folder = xr.ReadStringMax(64)
	o.Name = xr.ReadStringMax(8192)
	o.Offset = int64(xr.ReadUint64())
	o.Size = int32(xr.ReadUint32())
	o.Hash = xr.ReadBytesMax(64)
	o.Flags = xr.ReadUint32()
	_OptionsSize := int(xr.ReadUint32())
	if _OptionsSize > 64 {
		return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
	}
	o.Options = make([]Option, _OptionsSize)
	for i := range o.Options {
		(&o.Options[i]).decodeXDR(xr)
	}
	return xr.Error()
}
開發者ID:qbit,項目名稱:syncthing,代碼行數:17,代碼來源:message_xdr.go

示例8: DecodeXDRFrom

func (o *SessionInvitation) DecodeXDRFrom(xr *xdr.Reader) error {
	o.From = xr.ReadBytesMax(32)
	o.Key = xr.ReadBytesMax(32)
	o.Address = xr.ReadBytesMax(32)
	o.Port = xr.ReadUint16()
	o.ServerSocket = xr.ReadBool()
	return xr.Error()
}
開發者ID:readthecodes,項目名稱:syncthing,代碼行數:8,代碼來源:packets_xdr.go

示例9: decodeXDR

func (o *Device) decodeXDR(xr *xdr.Reader) error {
	o.ID = xr.ReadBytesMax(32)
	o.Flags = xr.ReadUint32()
	o.MaxLocalVersion = xr.ReadUint64()
	return xr.Error()
}
開發者ID:baa-archieve,項目名稱:syncthing,代碼行數:6,代碼來源:message_xdr.go


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