Example #1
0
func (f *Flags) WriteExternal(e *amf.Encoder) error {
	for i, b := range f.flags {
		if i < len(f.flags)-1 {
			b |= 0x80
		}
		if err := e.WriteUInt8(b); err != nil {
			return err
		}
	}
	return nil
}
Example #2
0
func writeAndCheckError(e *amf.Encoder, flag uint8, args ...interface{}) error {
	for i := 0; i < len(args); i += 2 {
		f := args[i].(uint8)
		if flag&f != f {
			continue
		}
		if err := e.WriteValue(args[i+1]); err != nil {
			return err
		}
	}
	return nil
}