MCPcopy Create free account
hub / github.com/digitalocean/go-libvirt / encodeArray

Method encodeArray

internal/go-xdr/xdr2/encode.go:417–427  ·  view source on GitHub ↗

encodeArray writes an XDR encoded integer representing the number of elements in the passed slice represented by the reflection value followed by the XDR encoded representation of each element in slice to the encapsulated writer and returns the number of bytes written. The ignoreOpaque flag control

(v reflect.Value, ignoreOpaque bool)

Source from the content-addressed store, hash-verified

415// RFC Section 4.13 - Variable-Length Array
416// Unsigned integer length followed by individually XDR encoded array elements
417func (enc *Encoder) encodeArray(v reflect.Value, ignoreOpaque bool) (int, error) {
418 numItems := uint32(v.Len())
419 n, err := enc.EncodeUint(numItems)
420 if err != nil {
421 return n, err
422 }
423
424 n2, err := enc.encodeFixedArray(v, ignoreOpaque)
425 n += n2
426 return n, err
427}
428
429// encodeStruct writes an XDR encoded representation of each value in the
430// exported fields of the struct represented by the passed reflection value to

Callers 2

encodeStructMethod · 0.95
encodeMethod · 0.95

Calls 3

EncodeUintMethod · 0.95
encodeFixedArrayMethod · 0.95
LenMethod · 0.80

Tested by

no test coverage detected