예제 #1
0
func (f *Flags) ReadExternal(d *amf.Decoder) error {
	for {
		b, err := d.ReadUInt8()
		if err != nil {
			return err
		}
		f.flags = append(f.flags, b&0x7F)
		if b&0x80 != 0x80 {
			break
		}
	}
	return nil
}
예제 #2
0
func (m *AcknowledgeMessage) ReadExternal(d *amf.Decoder) error {
	if err := m.AsyncMessage.ReadExternal(d); err != nil {
		return err
	}
	if err := m.flags.ReadExternal(d); err != nil {
		return err
	}
	// No flags defined
	for i := m.flags.CountBits(); i > 0; i-- {
		var dummy interface{}
		if err := d.ReadValue(&dummy); err != nil {
			return err
		}
	}
	return nil
}
예제 #3
0
func readAndCheckError(d *amf.Decoder, flag uint8, args ...interface{}) error {
	for i := 0; i < len(args); i += 2 {
		f := args[i].(uint8)
		if flag&f != f {
			continue
		}
		if err := d.ReadValue(args[i+1]); err != nil {
			return err
		}
	}
	for remaining := flag >> uint(len(args)/2); remaining > 0; remaining >>= 1 {
		if remaining&1 == 1 {
			var dummy interface{}
			if err := d.ReadValue(&dummy); err != nil {
				return err
			}
		}
	}
	return nil
}