public new void ReadExternal(IDataInput input) { base.ReadExternal(input); short[] flagsArray = ReadFlags(input); for (int i = 0; i < flagsArray.Length; i++) { short flags = flagsArray[i]; short reservedPosition = 0; if (i == 0) { if ((flags & OPERATION_FLAG) != 0) { operation = Convert.ToInt32(input.ReadObject()); } reservedPosition = 1; } // For forwards compatibility, read in any other flagged objects // to preserve the integrity of the input stream... if ((flags >> reservedPosition) != 0) { for (short j = reservedPosition; j < 6; j++) { if (((flags >> j) & 1) != 0) { input.ReadObject(); } } } } }
public virtual void ReadExternal(IDataInput input) { var flags = ReadFlags(input); for (int i = 0; i < flags.Count; i++) { int bits = 0; if (i == 0) { if ((flags[i] & BODY_FLAG) != 0) { Body = input.ReadObject(); } if ((flags[i] & CLIENT_ID_FLAG) != 0) { ClientId = input.ReadObject() as string; } if ((flags[i] & DESTINATION_FLAG) != 0) { Destination = input.ReadObject() as string; } if ((flags[i] & HEADERS_FLAG) != 0) { Headers = input.ReadObject(); } if ((flags[i] & MESSAGE_ID_FLAG) != 0) { MessageId = input.ReadObject() as string; } if ((flags[i] & TIMESTAMP_FLAG) != 0) { TimeStamp = Convert.ToInt64(input.ReadObject()); } if ((flags[i] & TIME_TO_LIVE_FLAG) != 0) { TimeToLive = Convert.ToInt64(input.ReadObject()); } bits = 7; } else if (i == 1) { if ((flags[i] & CLIENT_ID_BYTES_FLAG) != 0) { ClientIdBytes = input.ReadObject() as ByteArray; ClientId = RtmpUtil.FromByteArray(ClientIdBytes); } if ((flags[i] & MESSAGE_ID_BYTES_FLAG) != 0) { MessageIdBytes = input.ReadObject() as ByteArray; MessageId = RtmpUtil.FromByteArray(MessageIdBytes); } bits = 2; } ReadRemaining(input, flags[i], bits); } }
public virtual void ReadExternal(IDataInput input) { List<byte> flags = ReadFlags(input); int bits = 0; for (int i = 0; i < flags.Count; i++) { byte flag = flags[i]; if (i == 0) { if ((flag & 0x01) != 0) Body = input.ReadObject(); if ((flag & 0x02) != 0) ClientId = (string)input.ReadObject(); if ((flag & 0x04) != 0) Destination = (string)input.ReadObject(); if ((flag & 0x08) != 0) Headers = input.ReadObject() as AsObject; if ((flag & 0x10) != 0) MessageId = (string)input.ReadObject(); if ((flag & 0x20) != 0) Timestamp = Convert.ToInt64(input.ReadObject()); if ((flag & 0x40) != 0) TimeToLive = Convert.ToInt64(input.ReadObject()); bits = 7; } else if (i == 1) { if ((flag & 0x01) != 0) { ClientIdBytes = ((ByteArray)input.ReadObject()); } if ((flag & 0x02) != 0) { MessageIdBytes = ((ByteArray)input.ReadObject()); } bits = 2; } ReadRemaining(input, flag, bits); } flags = ReadFlags(input); for (int i = 0; i < flags.Count; i++) { byte flag = flags[i]; bits = 0; if (i == 0) { if ((flag & 0x01) != 0) CorrelationId = (string)input.ReadObject(); if ((flag & 0x02) != 0) { CorrelationIdBytes = ((ByteArray)input.ReadObject()); } bits = 2; } ReadRemaining(input, flag, bits); } }
public new void ReadExternal(IDataInput input) { base.ReadExternal(input); short[] flagsArray = ReadFlags(input); for (int i = 0; i < flagsArray.Length; i++) { short flags = flagsArray[i]; short reservedPosition = 0; if (i == 0) { if ((flags & CORRELATION_ID_FLAG) != 0) { correlationId = Convert.ToString(input.ReadObject()); } if ((flags & CORRELATION_ID_BYTES_FLAG) != 0) { var obj = input.ReadObject(); if (obj is ByteArray) { correlationIdBytes = (obj as ByteArray).ToArray(); } else { throw new InvalidCastException("AMF object is not ByteArray type cant convert to byte array."); } correlationId = new Guid(correlationIdBytes).ToString(); } reservedPosition = 2; } // For forwards compatibility, read in any other flagged objects // to preserve the integrity of the input stream... if ((flags >> reservedPosition) != 0) { for (short j = reservedPosition; j < 6; j++) { if (((flags >> j) & 1) != 0) { input.ReadObject(); } } } } }
public void ReadExternal(IDataInput input) { if (input.ReadObject() is object[] obj) { AddRange(obj); } }
public void ReadExternal(IDataInput input) { object[] objArray = input.ReadObject() as object[]; if (objArray == null) { return; } this.AddRange((IEnumerable <object>)objArray); }
public void ReadExternal(IDataInput input) { var obj = input.ReadObject() as object[]; if (obj != null) { this.AddRange(obj); } }
public new void ReadExternal(IDataInput input) { base.ReadExternal(input); short[] flagsArray = ReadFlags(input); for (int i = 0; i < flagsArray.Length; i++) { short flags = flagsArray[i]; short reservedPosition = 0; if (i == 0) { if ((flags & CORRELATION_ID_FLAG) != 0) correlationId = Convert.ToString(input.ReadObject()); if ((flags & CORRELATION_ID_BYTES_FLAG) != 0) { var obj = input.ReadObject(); if (obj is ByteArray) { correlationIdBytes = (obj as ByteArray).ToArray(); } else { throw new InvalidCastException("AMF object is not ByteArray type cant convert to byte array."); } correlationId = new Guid(correlationIdBytes).ToString(); } reservedPosition = 2; } // For forwards compatibility, read in any other flagged objects // to preserve the integrity of the input stream... if ((flags >> reservedPosition) != 0) { for (short j = reservedPosition; j < 6; j++) { if (((flags >> j) & 1) != 0) input.ReadObject(); } } } }
public void ReadExternal(IDataInput input) { if (input.ReadObject() is IDictionary <string, object> values) { foreach (var(key, value) in values) { this[key] = value; } } }
public override void ReadExternal(IDataInput input) { base.ReadExternal(input); var flags = ReadFlags(input); for (int i = 0; i < flags.Count; i++) { int bits = 0; if (i == 0) { if ((flags[i] & CORRELATION_ID_FLAG) != 0) { CorrelationId = input.ReadObject() as string; } if ((flags[i] & CORRELATION_ID_BYTES_FLAG) != 0) { CorrelationId = RtmpUtil.FromByteArray(input.ReadObject() as ByteArray); } bits = 2; } ReadRemaining(input, flags[i], bits); } }
public void ReadExternal(IDataInput input) { IDictionary <string, object> dictionary = input.ReadObject() as IDictionary <string, object>; if (dictionary == null) { return; } foreach (KeyValuePair <string, object> keyValuePair in (IEnumerable <KeyValuePair <string, object> >)dictionary) { this[keyValuePair.Key] = keyValuePair.Value; } }
public void ReadExternal(IDataInput input) { object obj2 = input.ReadObject(); if (obj2 is IDictionary) { IDictionary dictionary = obj2 as IDictionary; foreach (DictionaryEntry entry in dictionary) { base.Add(entry.Key as string, entry.Value); } } }
/// <summary> /// Decode the ObjectProxy from a data stream. /// </summary> /// <param name="input">IDataInput interface.</param> public void ReadExternal(IDataInput input) { object value = input.ReadObject(); if (value is IDictionary) { IDictionary dictionary = value as IDictionary; foreach (DictionaryEntry entry in dictionary) { this.Add(entry.Key as string, entry.Value); } } }
public void ReadExternal(IDataInput input) { var obj = input.ReadObject(); var dictionary = obj as IDictionary <string, object>; if (dictionary != null) { foreach (var pair in dictionary) { this[pair.Key] = pair.Value; } } }
protected void ReadRemaining(IDataInput input, int flag, int bits) { if ((flag >> bits) != 0) { for (int o = bits; o < 6; o++) { if ((flag >> o & 1) != 0) { input.ReadObject(); } } } }
protected void ReadRemaining(IDataInput input, int flag, int bits) { if (flag >> bits == 0) { return; } for (int index = bits; index < 6; ++index) { if ((flag >> index & 1) != 0) { input.ReadObject(); } } }
protected void ReadRemaining(IDataInput input, int flag, int bits) { // For forwards compatibility, read in any other flagged objects to // preserve the integrity of the input stream... if ((flag >> bits) != 0) { for (var o = bits; o < 6; o++) { if (((flag >> o) & 1) != 0) { input.ReadObject(); } } } }
public override void ReadExternal(IDataInput input) { base.ReadExternal(input); var flags = ReadFlags(input); for (int i = 0; i < flags.Count; i++) { int bits = 0; if (i == 0) { if ((flags[i] & OPERATION_FLAG) != 0) { SetOperation((uint)input.ReadObject()); } bits = 1; } ReadRemaining(input, flags[i], bits); } }
public void ReadExternal(IDataInput input) { base.ReadExternal(input); short[] flagsArray = readFlags(input); for (int i = 0; i < flagsArray.Length; i++) { short flags = flagsArray[i]; short reservedPosition = 0; // For forwards compatibility, read in any other flagged objects // to preserve the integrity of the input stream... if ((flags >> reservedPosition) != 0) { for (short j = reservedPosition; j < 6; j++) { if (((flags >> j) & 1) != 0) { input.ReadObject(); } } } } }
protected void ReadRemaining(IDataInput input, int flag, int bits) { // For forwards compatibility, read in any other flagged objects to // preserve the integrity of the input stream... if ((flag >> bits) != 0) { for (int o = bits; o < 6; o++) { if (((flag >> o) & 1) != 0) input.ReadObject(); } } }
/** * * * While this class itself does not implement java.io.Externalizable, * SmallMessage implementations will typically use Externalizable to * serialize themselves in a smaller form. This method supports this * functionality by implementing Externalizable.readExternal(ObjectInput) to * deserialize the properties for this abstract base class. */ public void ReadExternal(IDataInput input) { short[] flagsArray = ReadFlags(input); for (int i = 0; i < flagsArray.Length; i++) { short flags = flagsArray[i]; short reservedPosition = 0; if (i == 0) { if ((flags & BODY_FLAG) != 0) { ReadExternalBody(input); } if ((flags & CLIENT_ID_FLAG) != 0) { clientId = input.ReadObject(); } if ((flags & DESTINATION_FLAG) != 0) { destination = Convert.ToString(input.ReadObject()); } if ((flags & HEADERS_FLAG) != 0) { //headers = (Map)input.ReadObject(); var instance = input.ReadObject(); if (instance is ASObject) { _headers = instance as ASObject; } else { Type type = instance.GetType(); PropertyInfo[] pArray = type.GetProperties(); MemberInfo[] mArray = type.GetMembers(); FieldInfo[] fArray = type.GetFields(); foreach (var p in pArray) { _headers.Add(p.Name, p.GetValue(instance, BindingFlags.DeclaredOnly | BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance, null, null, null)); } } } if ((flags & MESSAGE_ID_FLAG) != 0) { messageId = Convert.ToString(input.ReadObject()); } if ((flags & TIMESTAMP_FLAG) != 0) { timestamp = Convert.ToInt64(input.ReadObject()); } if ((flags & TIME_TO_LIVE_FLAG) != 0) { timeToLive = Convert.ToInt64(input.ReadObject()); } reservedPosition = 7; } else if (i == 1) { if ((flags & CLIENT_ID_BYTES_FLAG) != 0) { var obj = input.ReadObject(); if (obj is ByteArray) { clientIdBytes = (obj as ByteArray).ToArray(); } else { throw new InvalidCastException("AMF object is not ByteArray type cant convert to byte array."); } clientId = new Guid(clientIdBytes).ToString(); } if ((flags & MESSAGE_ID_BYTES_FLAG) != 0) { var obj = input.ReadObject(); if (obj is ByteArray) { messageIdBytes = (obj as ByteArray).ToArray(); } else { throw new InvalidCastException("AMF object is not ByteArray type cant convert to byte array."); } messageId = new Guid(messageIdBytes).ToString(); } reservedPosition = 2; } // For forwards compatibility, read in any other flagged objects to // preserve the integrity of the input stream... if ((flags >> reservedPosition) != 0) { for (short j = reservedPosition; j < 6; j++) { if (((flags >> j) & 1) != 0) { input.ReadObject(); } } } } }
protected internal virtual void readExternalBody(IDataInput input) { body = input.ReadObject(); }
public virtual void ReadExternal(IDataInput input) { short[] flagsArray = readFlags(input); for (int i = 0; i < flagsArray.Length; i++) { short flags = flagsArray[i]; short reservedPosition = 0; if (i == 0) { if ((flags & BODY_FLAG) != 0) { readExternalBody(input); } if ((flags & CLIENT_ID_FLAG) != 0) { clientId = input.ReadObject(); } if ((flags & DESTINATION_FLAG) != 0) { destination = (string)input.ReadObject(); } if ((flags & HEADERS_FLAG) != 0) { headers = (Object)input.ReadObject(); } if ((flags & MESSAGE_ID_FLAG) != 0) { messageId = (string)input.ReadObject(); } if ((flags & TIMESTAMP_FLAG) != 0) { timestamp = (long)((double)input.ReadObject()); } if ((flags & TIME_TO_LIVE_FLAG) != 0) { timeToLive = (long)((double)input.ReadObject()); } reservedPosition = 7; } else if (i == 1) { if ((flags & CLIENT_ID_BYTES_FLAG) != 0) { clientIdBytes = ((ByteArray)input.ReadObject()).ToArray(); clientId = (new Guid(clientIdBytes)).ToString("D"); } if ((flags & MESSAGE_ID_BYTES_FLAG) != 0) { messageIdBytes = ((ByteArray)input.ReadObject()).ToArray(); messageId = (new Guid(messageIdBytes)).ToString("D"); } reservedPosition = 2; } // For forwards compatibility, read in any other flagged objects to // preserve the integrity of the input stream... if ((flags >> reservedPosition) != 0) { for (short j = reservedPosition; j < 6; j++) { if (((flags >> j) & 1) != 0) { input.ReadObject(); } } } } }
/// <summary> /// Decode the ArrayCollection from a data stream. /// </summary> /// <param name="input">IDataInput interface.</param> public void ReadExternal(IDataInput input) { _list = input.ReadObject() as IList; }
public new void ReadExternal(IDataInput input) { base.ReadExternal(input); short[] flagsArray = ReadFlags(input); for (int i = 0; i < flagsArray.Length; i++) { short flags = flagsArray[i]; short reservedPosition = 0; if (i == 0) { if ((flags & OPERATION_FLAG) != 0) operation = Convert.ToInt32(input.ReadObject()); reservedPosition = 1; } // For forwards compatibility, read in any other flagged objects // to preserve the integrity of the input stream... if ((flags >> reservedPosition) != 0) { for (short j = reservedPosition; j < 6; j++) { if (((flags >> j) & 1) != 0) { input.ReadObject(); } } } } }
public void ReadExternal(IDataInput input) { // AbstractMessage int state; PartFlags[] flags = ReadFlags(input); for (int i = 0; i < flags.Length; i++) { state = 0; PartFlags flag = flags[i]; if (i == 0) { if ((flag & PartFlags.BODY_FLAG) != 0) { Body = input.ReadObject(); } else { Body = null; } if ((flag & PartFlags.CLIENT_ID_FLAG) != 0) ClientId = input.ReadObject() as string; if ((flag & PartFlags.DESTINATION_FLAG) != 0) Destination = input.ReadUtf(); if ((flag & PartFlags.HEADERS_FLAG) != 0) Headers = input.ReadObject() as Dictionary<string, object>; if ((flag & PartFlags.MESSAGE_ID_FLAG) != 0) MessageId = input.ReadUtf(); if ((flag & PartFlags.TIMESTAMP_FLAG) != 0) Timestamp = (long)(double)input.ReadObject(); if ((flag & PartFlags.TIME_TO_LIVE_FLAG) != 0) TimeToLive = (long)input.ReadObject(); state = 7; } else if (i == 1) { // clientidbytes if (((int)flag & 0x1) != 0) { clientIdBytes = input.ReadObject() as ByteArray; ClientId = AmfMessageUtils.UIDBytesToString(clientIdBytes.ToArray()); } // messageidbytes if (((int)flag & 0x2) != 0) { messageIdBytes = input.ReadObject() as ByteArray; MessageId = AmfMessageUtils.UIDBytesToString(messageIdBytes.ToArray()); } state = 2; } if (((uint)flag >> state) != 0) { int local6 = state; while (local6 < 6) { if ((((uint)flag >> local6) & 0x1) != 0) { input.ReadObject(); } local6++; } } } ProcessAsyncMessage(input); ProcessAcknowledgeMessage(input); }
private void ProcessAsyncMessage(IDataInput input) { var flags = ReadFlags(input); for (int idx = 0; idx < flags.Length; idx++) { var flag = (uint)flags[idx]; int x = 0; if (idx == 0) { //CORRELATION_ID_FLAG if ((flag & 0x1) != 0) { CorrelationId = input.ReadObject() as string; } // CORRELATION_ID_BYTES_FLAG if ((flag & 0x2) != 0) { correlationIdBytes = input.ReadObject() as ByteArray; CorrelationId = AmfMessageUtils.UIDBytesToString(correlationIdBytes.ToArray()); } x = 2; } if ((flag >> x) != 0) { int y = x; while (y < 6) { if (((flag >> y) & 0x1) != 0) { input.ReadObject(); } y++; } } } }
private void ProcessAcknowledgeMessage(IDataInput input) { var flags2 = ReadFlags(input); for (int idx = 0; idx < flags2.Length; idx++) { var flag2 = flags2[idx]; int x = 0; if (((uint)flag2 >> x) != 0) { int y = x; while (y < 6) { if ((((uint)flag2 >> y) & 0x1) != 0) { input.ReadObject(); } y++; } } } }
public virtual void ReadExternal(IDataInput input) { List <byte> byteList1 = this.ReadFlags(input); int bits1 = 0; for (int index = 0; index < byteList1.Count; ++index) { byte num = byteList1[index]; if (index == 0) { if (((int)num & 1) != 0) { this.Body = input.ReadObject(); } if (((int)num & 2) != 0) { this.ClientId = (string)input.ReadObject(); } if (((int)num & 4) != 0) { this.Destination = (string)input.ReadObject(); } if (((int)num & 8) != 0) { this.Headers = input.ReadObject() as AsObject; } if (((int)num & 16) != 0) { this.MessageId = (string)input.ReadObject(); } if (((int)num & 32) != 0) { this.Timestamp = Convert.ToInt64(input.ReadObject()); } if (((int)num & 64) != 0) { this.TimeToLive = Convert.ToInt64(input.ReadObject()); } bits1 = 7; } else if (index == 1) { if (((int)num & 1) != 0) { this.ClientIdBytes = (ByteArray)input.ReadObject(); } if (((int)num & 2) != 0) { this.MessageIdBytes = (ByteArray)input.ReadObject(); } bits1 = 2; } this.ReadRemaining(input, (int)num, bits1); } List <byte> byteList2 = this.ReadFlags(input); for (int index = 0; index < byteList2.Count; ++index) { byte num = byteList2[index]; int bits2 = 0; if (index == 0) { if (((int)num & 1) != 0) { this.CorrelationId = (string)input.ReadObject(); } if (((int)num & 2) != 0) { this.CorrelationIdBytes = (ByteArray)input.ReadObject(); } bits2 = 2; } this.ReadRemaining(input, (int)num, bits2); } }
public virtual void ReadExternal(IDataInput input) { var flags = ReadFlags(input); var bits = 0; for (var i = 0; i < flags.Count; i++) { var flag = flags[i]; if (i == 0) { if ((flag & 0x01) != 0) { Body = input.ReadObject(); } if ((flag & 0x02) != 0) { ClientId = (string)input.ReadObject(); } if ((flag & 0x04) != 0) { Destination = (string)input.ReadObject(); } if ((flag & 0x08) != 0) { Headers = input.ReadObject() as AsObject; } if ((flag & 0x10) != 0) { MessageId = (string)input.ReadObject(); } if ((flag & 0x20) != 0) { Timestamp = Convert.ToInt64(input.ReadObject()); } if ((flag & 0x40) != 0) { TimeToLive = Convert.ToInt64(input.ReadObject()); } bits = 7; } else if (i == 1) { if ((flag & 0x01) != 0) { ClientIdBytes = ((ByteArray)input.ReadObject()); } if ((flag & 0x02) != 0) { MessageIdBytes = ((ByteArray)input.ReadObject()); } bits = 2; } ReadRemaining(input, flag, bits); } flags = ReadFlags(input); for (var i = 0; i < flags.Count; i++) { var flag = flags[i]; bits = 0; if (i == 0) { if ((flag & 0x01) != 0) { CorrelationId = (string)input.ReadObject(); } if ((flag & 0x02) != 0) { CorrelationIdBytes = ((ByteArray)input.ReadObject()); } bits = 2; } ReadRemaining(input, flag, bits); } }
/** * * Used by the readExtenral method to read the body. * * @param input Object input. * @throws IOException * @throws ClassNotFoundException */ protected void ReadExternalBody(IDataInput input) { body = input.ReadObject(); }