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


Golang xdr.Unmarshaller类代码示例

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


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

示例1: UnmarshalXDRFrom

func (o *FileInfo) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.Name = u.UnmarshalStringMax(8192)
	o.Flags = u.UnmarshalUint32()
	o.Modified = int64(u.UnmarshalUint64())
	(&o.Version).UnmarshalXDRFrom(u)
	o.LocalVersion = int64(u.UnmarshalUint64())
	_BlocksSize := int(u.UnmarshalUint32())
	if _BlocksSize < 0 {
		return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 10000000)
	} else if _BlocksSize == 0 {
		o.Blocks = nil
	} else {
		if _BlocksSize > 10000000 {
			return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 10000000)
		}
		if _BlocksSize <= len(o.Blocks) {
			o.Blocks = o.Blocks[:_BlocksSize]
		} else {
			o.Blocks = make([]BlockInfo, _BlocksSize)
		}
		for i := range o.Blocks {
			(&o.Blocks[i]).UnmarshalXDRFrom(u)
		}
	}
	return u.Error
}
开发者ID:carriercomm,项目名称:syncthing,代码行数:26,代码来源:message_xdr.go

示例2: UnmarshalXDRFrom

func (o *SessionInvitation) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.From = u.UnmarshalBytesMax(32)
	o.Key = u.UnmarshalBytesMax(32)
	o.Address = u.UnmarshalBytesMax(32)
	o.Port = u.UnmarshalUint16()
	o.ServerSocket = u.UnmarshalBool()
	return u.Error
}
开发者ID:letiemble,项目名称:syncthing,代码行数:8,代码来源:packets_xdr.go

示例3: UnmarshalXDRFrom

func (o *VersionList) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	_versionsSize := int(u.UnmarshalUint32())
	if _versionsSize < 0 {
		return xdr.ElementSizeExceeded("versions", _versionsSize, 0)
	} else if _versionsSize == 0 {
		o.versions = nil
	} else {
		if _versionsSize <= len(o.versions) {
			o.versions = o.versions[:_versionsSize]
		} else {
			o.versions = make([]fileVersion, _versionsSize)
		}
		for i := range o.versions {
			(&o.versions[i]).UnmarshalXDRFrom(u)
		}
	}
	return u.Error
}
开发者ID:carriercomm,项目名称:syncthing,代码行数:18,代码来源:leveldb_xdr.go

示例4: UnmarshalXDRFrom

func (o *Device) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.ID = u.UnmarshalBytesMax(32)
	_AddressesSize := int(u.UnmarshalUint32())
	if _AddressesSize < 0 {
		return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 16)
	} else if _AddressesSize == 0 {
		o.Addresses = nil
	} else {
		if _AddressesSize > 16 {
			return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 16)
		}
		if _AddressesSize <= len(o.Addresses) {
			o.Addresses = o.Addresses[:_AddressesSize]
		} else {
			o.Addresses = make([]Address, _AddressesSize)
		}
		for i := range o.Addresses {
			(&o.Addresses[i]).UnmarshalXDRFrom(u)
		}
	}
	return u.Error
}
开发者ID:carriercomm,项目名称:syncthing,代码行数:22,代码来源:localpackets_xdr.go

示例5: UnmarshalXDRFrom

func (o *Announce) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.Magic = u.UnmarshalUint32()
	(&o.This).UnmarshalXDRFrom(u)
	_ExtraSize := int(u.UnmarshalUint32())
	if _ExtraSize < 0 {
		return xdr.ElementSizeExceeded("Extra", _ExtraSize, 16)
	} else if _ExtraSize == 0 {
		o.Extra = nil
	} else {
		if _ExtraSize > 16 {
			return xdr.ElementSizeExceeded("Extra", _ExtraSize, 16)
		}
		if _ExtraSize <= len(o.Extra) {
			o.Extra = o.Extra[:_ExtraSize]
		} else {
			o.Extra = make([]Device, _ExtraSize)
		}
		for i := range o.Extra {
			(&o.Extra[i]).UnmarshalXDRFrom(u)
		}
	}
	return u.Error
}
开发者ID:tcrutt,项目名称:syncthing,代码行数:23,代码来源:localpackets_xdr.go

示例6: UnmarshalXDRFrom

func (v *Vector) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	l := int(u.UnmarshalUint32())
	if l > 1e6 {
		return xdr.ElementSizeExceeded("number of counters", l, 1e6)
	}
	n := make(Vector, l)
	for i := range n {
		n[i].ID = ShortID(u.UnmarshalUint64())
		n[i].Value = u.UnmarshalUint64()
	}
	*v = n
	return u.Error
}
开发者ID:tcrutt,项目名称:syncthing,代码行数:13,代码来源:vector_xdr.go

示例7: UnmarshalXDRFrom

func (o *XDRA) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.Name = u.UnmarshalString()
	o.BirthDay = int64(u.UnmarshalUint64())
	o.Phone = u.UnmarshalString()
	o.Siblings = int32(u.UnmarshalUint32())
	o.Spouse = u.UnmarshalBool()
	o.Money = u.UnmarshalUint64()
	return u.Error
}
开发者ID:alecthomas,项目名称:go_serialization_benchmarks,代码行数:9,代码来源:structdefxdr_generated.go

示例8: UnmarshalXDRFrom

func (o *FileInfoTruncated) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.Name = u.UnmarshalStringMax(8192)
	o.Flags = u.UnmarshalUint32()
	o.Modified = int64(u.UnmarshalUint64())
	(&o.Version).UnmarshalXDRFrom(u)
	o.LocalVersion = int64(u.UnmarshalUint64())
	_BlocksSize := int(u.UnmarshalUint32())
	if _BlocksSize < 0 {
		return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 1000000)
	} else if _BlocksSize == 0 {
		o.Blocks = nil
	} else {
		if _BlocksSize > 1000000 {
			return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 1000000)
		}
		for i := 0; i < _BlocksSize; i++ {
			size := int64(u.UnmarshalUint32())
			o.CachedSize += size
			u.UnmarshalBytes()
		}
	}

	return u.Error
}
开发者ID:tcrutt,项目名称:syncthing,代码行数:24,代码来源:truncated.go

示例9: UnmarshalXDRFrom

func (h *header) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	v := u.UnmarshalUint32()
	*h = decodeHeader(v)
	return u.Error
}
开发者ID:tcrutt,项目名称:syncthing,代码行数:5,代码来源:header.go

示例10: UnmarshalXDRFrom

func (o *Version13HelloMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.DeviceName = u.UnmarshalStringMax(64)
	o.ClientName = u.UnmarshalStringMax(64)
	o.ClientVersion = u.UnmarshalStringMax(64)
	return u.Error
}
开发者ID:letiemble,项目名称:syncthing,代码行数:6,代码来源:hello_v0.13_xdr.go

示例11: UnmarshalXDRFrom

func (o *Opaque) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	copy((*o)[:], u.UnmarshalRaw(32))
	return u.Error
}
开发者ID:letiemble,项目名称:syncthing,代码行数:4,代码来源:encdec_test.go

示例12: UnmarshalXDRFrom

func (o *OtherStruct) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.F1 = u.UnmarshalUint32()
	o.F2 = u.UnmarshalString()
	return u.Error
}
开发者ID:letiemble,项目名称:syncthing,代码行数:5,代码来源:encdec_xdr_test.go


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