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


Golang Reader.ReadStringMax方法代码示例

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


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

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

示例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 *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

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

func (o *IndexMessage) DecodeXDRFrom(xr *xdr.Reader) error {
	o.Folder = xr.ReadStringMax(256)
	_FilesSize := int(xr.ReadUint32())
	if _FilesSize < 0 {
		return xdr.ElementSizeExceeded("Files", _FilesSize, 1000000)
	}
	if _FilesSize > 1000000 {
		return xdr.ElementSizeExceeded("Files", _FilesSize, 1000000)
	}
	o.Files = make([]FileInfo, _FilesSize)
	for i := range o.Files {
		(&o.Files[i]).DecodeXDRFrom(xr)
	}
	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,代码行数:27,代码来源:message_xdr.go

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

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

示例8: DecodeXDRFrom

func (o *FileInfo) DecodeXDRFrom(xr *xdr.Reader) error {
	o.Name = xr.ReadStringMax(8192)
	o.Flags = xr.ReadUint32()
	o.Modified = int64(xr.ReadUint64())
	(&o.Version).DecodeXDRFrom(xr)
	o.LocalVersion = int64(xr.ReadUint64())
	_BlocksSize := int(xr.ReadUint32())
	if _BlocksSize < 0 {
		return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 0)
	}
	o.Blocks = make([]BlockInfo, _BlocksSize)
	for i := range o.Blocks {
		(&o.Blocks[i]).DecodeXDRFrom(xr)
	}
	return xr.Error()
}
开发者ID:kattunga,项目名称:syncthing,代码行数:16,代码来源:message_xdr.go

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

示例10: DecodeXDRFrom

func (o *FileInfoTruncated) DecodeXDRFrom(xr *xdr.Reader) error {
	o.Name = xr.ReadStringMax(8192)
	o.Flags = xr.ReadUint32()
	o.Modified = int64(xr.ReadUint64())
	(&o.Version).DecodeXDRFrom(xr)
	o.LocalVersion = int64(xr.ReadUint64())
	_BlocksSize := int(xr.ReadUint32())
	if _BlocksSize < 0 {
		return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 1000000)
	}
	if _BlocksSize > 1000000 {
		return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 1000000)
	}

	buf := make([]byte, 64)
	for i := 0; i < _BlocksSize; i++ {
		size := xr.ReadUint32()
		o.CachedSize += int64(size)
		xr.ReadBytesMaxInto(64, buf)
	}
	return xr.Error()
}
开发者ID:wmwwmv,项目名称:syncthing,代码行数:22,代码来源:truncated.go

示例11: DecodeXDRFrom

func (o *Relay) DecodeXDRFrom(xr *xdr.Reader) error {
	o.Address = xr.ReadStringMax(256)
	o.Latency = int32(xr.ReadUint32())
	return xr.Error()
}
开发者ID:rwx-zwx-awx,项目名称:syncthing,代码行数:5,代码来源:packets_xdr.go

示例12: DecodeXDRFrom

func (o *Address) DecodeXDRFrom(xr *xdr.Reader) error {
	o.URL = xr.ReadStringMax(2083)
	return xr.Error()
}
开发者ID:wmwwmv,项目名称:syncthing,代码行数:4,代码来源:localpackets_xdr.go


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