本文整理汇总了Golang中github.com/calmh/xdr.Unmarshaller.UnmarshalBytes方法的典型用法代码示例。如果您正苦于以下问题:Golang Unmarshaller.UnmarshalBytes方法的具体用法?Golang Unmarshaller.UnmarshalBytes怎么用?Golang Unmarshaller.UnmarshalBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/calmh/xdr.Unmarshaller
的用法示例。
在下文中一共展示了Unmarshaller.UnmarshalBytes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: UnmarshalXDRFrom
func (o *XDRBenchStruct) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
o.I1 = u.UnmarshalUint64()
o.I2 = u.UnmarshalUint32()
o.I3 = u.UnmarshalUint16()
o.I4 = u.UnmarshalUint8()
o.Bs0 = u.UnmarshalBytesMax(128)
o.Bs1 = u.UnmarshalBytes()
_Is0Size := int(u.UnmarshalUint32())
if _Is0Size < 0 {
return xdr.ElementSizeExceeded("Is0", _Is0Size, 0)
} else if _Is0Size == 0 {
o.Is0 = nil
} else {
if _Is0Size <= len(o.Is0) {
o.Is0 = o.Is0[:_Is0Size]
} else {
o.Is0 = make([]int32, _Is0Size)
}
for i := range o.Is0 {
o.Is0[i] = int32(u.UnmarshalUint32())
}
}
o.S0 = u.UnmarshalStringMax(128)
o.S1 = u.UnmarshalString()
return u.Error
}
示例2: 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
}
示例3: UnmarshalXDRFrom
func (o *ResponseMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
o.Data = u.UnmarshalBytes()
o.Code = int32(u.UnmarshalUint32())
return u.Error
}
示例4: UnmarshalXDRFrom
func (o *fileVersion) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
(&o.version).UnmarshalXDRFrom(u)
o.device = u.UnmarshalBytes()
return u.Error
}