本文整理匯總了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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例9: UnmarshalXDRFrom
func (h *header) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
v := u.UnmarshalUint32()
*h = decodeHeader(v)
return u.Error
}
示例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
}
示例11: UnmarshalXDRFrom
func (o *Opaque) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
copy((*o)[:], u.UnmarshalRaw(32))
return u.Error
}
示例12: UnmarshalXDRFrom
func (o *OtherStruct) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
o.F1 = u.UnmarshalUint32()
o.F2 = u.UnmarshalString()
return u.Error
}