本文整理汇总了Golang中github.com/calmh/xdr.Unmarshaller.UnmarshalBytesMax方法的典型用法代码示例。如果您正苦于以下问题:Golang Unmarshaller.UnmarshalBytesMax方法的具体用法?Golang Unmarshaller.UnmarshalBytesMax怎么用?Golang Unmarshaller.UnmarshalBytesMax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/calmh/xdr.Unmarshaller
的用法示例。
在下文中一共展示了Unmarshaller.UnmarshalBytesMax方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 *RequestMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
o.Folder = u.UnmarshalStringMax(256)
o.Name = u.UnmarshalStringMax(8192)
o.Offset = int64(u.UnmarshalUint64())
o.Size = int32(u.UnmarshalUint32())
o.Hash = u.UnmarshalBytesMax(64)
o.Flags = u.UnmarshalUint32()
_OptionsSize := int(u.UnmarshalUint32())
if _OptionsSize < 0 {
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
} else if _OptionsSize == 0 {
o.Options = nil
} else {
if _OptionsSize > 64 {
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
}
if _OptionsSize <= len(o.Options) {
o.Options = o.Options[:_OptionsSize]
} else {
o.Options = make([]Option, _OptionsSize)
}
for i := range o.Options {
(&o.Options[i]).UnmarshalXDRFrom(u)
}
}
return u.Error
}
示例3: UnmarshalXDRFrom
func (o *TestStruct) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
o.B = u.UnmarshalBool()
o.I = int(u.UnmarshalUint64())
o.I8 = int8(u.UnmarshalUint8())
o.UI8 = u.UnmarshalUint8()
o.I16 = int16(u.UnmarshalUint16())
o.UI16 = u.UnmarshalUint16()
o.I32 = int32(u.UnmarshalUint32())
o.UI32 = u.UnmarshalUint32()
o.I64 = int64(u.UnmarshalUint64())
o.UI64 = u.UnmarshalUint64()
o.BS = u.UnmarshalBytesMax(1024)
o.S = u.UnmarshalStringMax(1024)
(&o.C).UnmarshalXDRFrom(u)
_SSSize := int(u.UnmarshalUint32())
if _SSSize < 0 {
return xdr.ElementSizeExceeded("SS", _SSSize, 1024)
} else if _SSSize == 0 {
o.SS = nil
} else {
if _SSSize > 1024 {
return xdr.ElementSizeExceeded("SS", _SSSize, 1024)
}
if _SSSize <= len(o.SS) {
for i := _SSSize; i < len(o.SS); i++ {
o.SS[i] = ""
}
o.SS = o.SS[:_SSSize]
} else {
o.SS = make([]string, _SSSize)
}
for i := range o.SS {
o.SS[i] = u.UnmarshalString()
}
}
(&o.ES).UnmarshalXDRFrom(u)
(&o.OS).UnmarshalXDRFrom(u)
_OSsSize := int(u.UnmarshalUint32())
if _OSsSize < 0 {
return xdr.ElementSizeExceeded("OSs", _OSsSize, 0)
} else if _OSsSize == 0 {
o.OSs = nil
} else {
if _OSsSize <= len(o.OSs) {
o.OSs = o.OSs[:_OSsSize]
} else {
o.OSs = make([]OtherStruct, _OSsSize)
}
for i := range o.OSs {
(&o.OSs[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)
}
}
_RelaysSize := int(u.UnmarshalUint32())
if _RelaysSize < 0 {
return xdr.ElementSizeExceeded("Relays", _RelaysSize, 16)
} else if _RelaysSize == 0 {
o.Relays = nil
} else {
if _RelaysSize > 16 {
return xdr.ElementSizeExceeded("Relays", _RelaysSize, 16)
}
if _RelaysSize <= len(o.Relays) {
o.Relays = o.Relays[:_RelaysSize]
} else {
o.Relays = make([]Relay, _RelaysSize)
}
for i := range o.Relays {
(&o.Relays[i]).UnmarshalXDRFrom(u)
}
}
return u.Error
}
示例5: 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
}