Esempio n. 1
0
func ExampleMultipleAmf0_Unmarshals_MultipleTimes() {
	var s protocol.Amf0String
	var n protocol.Amf0Number
	var b protocol.Amf0Boolean

	var d bytes.Buffer // read from network.

	if err := core.Unmarshals(&d, &s, &n, &b); err != nil {
		_ = err // error
	} else {
		_, _, _ = s, n, b // use unmarshaled amf0 instances.
	}

	if d.Len() > 0 {
		var extra protocol.Amf0String
		if err := core.Unmarshals(&d, &extra); err != nil {
			_ = err // error
		} else {
			_ = extra // use marshaled amf0 extra instance.
		}
	}
}
Esempio n. 2
0
func ExampleMultipleAmf0_Unmarshals() {
	var s protocol.Amf0String
	var n protocol.Amf0Number
	var b protocol.Amf0Boolean

	var d bytes.Buffer // read from network.

	if err := core.Unmarshals(&d, &s, &n, &b); err != nil {
		_ = err
	} else {
		_, _, _ = s, n, b // use unmarshaled amf0 instances.
	}
}