public void WriteExternal(IDataOutput output) { string json = JsonConvert.SerializeObject(Data); byte[] b = Encoding.UTF8.GetBytes(json); output.WriteByte((byte)(b.Length >> 24)); output.WriteByte((byte)(b.Length >> 16)); output.WriteByte((byte)(b.Length >> 8)); output.WriteByte((byte)(b.Length)); output.WriteBytes(b); }
public void WriteExternal(IDataOutput output) { Dictionary<string, object> dict = new Dictionary<string, object>(); foreach (var x in this) dict[x.Key] = x.Value; string json = Serializer.Serialize(dict); byte[] b = Encoding.UTF8.GetBytes(json); output.WriteByte((byte)(b.Length >> 24)); output.WriteByte((byte)(b.Length >> 16)); output.WriteByte((byte)(b.Length >> 8)); output.WriteByte((byte)(b.Length)); output.WriteBytes(b); }
public new void WriteExternal(IDataOutput output) { base.WriteExternal(output); if (correlationIdBytes == null && correlationId != null) { correlationIdBytes = new Guid(correlationId).ToByteArray(); } byte flags = 0; if (correlationId != null && correlationIdBytes == null) { flags |= CORRELATION_ID_FLAG; } if (correlationIdBytes != null) { flags |= CORRELATION_ID_BYTES_FLAG; } output.WriteByte(flags); if (correlationId != null && correlationIdBytes == null) { output.WriteObject(correlationId); } if (correlationIdBytes != null) { output.WriteObject(correlationIdBytes); } }
public override void WriteExternal(IDataOutput output) { base.WriteExternal(output); if (CorrelationIdBytes == null) { CorrelationIdBytes = RtmpUtil.ToByteArray(CorrelationId); } int flag = 0; if (CorrelationId != null && CorrelationIdBytes == null) { flag |= CORRELATION_ID_FLAG; } if (CorrelationIdBytes != null) { flag |= CORRELATION_ID_BYTES_FLAG; } output.WriteByte((byte)flag); if (CorrelationId != null && CorrelationIdBytes == null) { output.WriteObject(CorrelationId); } if (CorrelationIdBytes != null) { output.WriteObject(CorrelationIdBytes); } }
public new void WriteExternal(IDataOutput output) { base.WriteExternal(output); short flags = 0; output.WriteByte((byte)flags); }
public void WriteExternal(IDataOutput output) { Dictionary <string, object> dict = new Dictionary <string, object>(); foreach (var x in this) { dict[x.Key] = x.Value; } string json = Serializer.Serialize(dict); byte[] b = Encoding.UTF8.GetBytes(json); output.WriteByte((byte)(b.Length >> 24)); output.WriteByte((byte)(b.Length >> 16)); output.WriteByte((byte)(b.Length >> 8)); output.WriteByte((byte)(b.Length)); output.WriteBytes(b); }
public new void WriteExternal(IDataOutput output) { base.WriteExternal(output); byte flags = 0; if (operation != 0) { flags |= OPERATION_FLAG; } output.WriteByte(flags); if (operation != 0) { output.WriteObject(operation); } }
public override void WriteExternal(IDataOutput output) { base.WriteExternal(output); int flags = 0; if (Operation != 0) { flags |= OPERATION_FLAG; } output.WriteByte((byte)flags); if (Operation != 0) { output.WriteObject(Operation); } }
public override void WriteExternal(IDataOutput output) { base.WriteExternal(output); if (CorrelationIdBytes == null) CorrelationIdBytes = RtmpUtil.ToByteArray(CorrelationId); int flag = 0; if (CorrelationId != null && CorrelationIdBytes == null) flag |= CORRELATION_ID_FLAG; if (CorrelationIdBytes != null) flag |= CORRELATION_ID_BYTES_FLAG; output.WriteByte((byte)flag); if (CorrelationId != null && CorrelationIdBytes == null) output.WriteObject(CorrelationId); if (CorrelationIdBytes != null) output.WriteObject(CorrelationIdBytes); }
public virtual void WriteExternal(IDataOutput output) { byte f1 = 0; if (Body != null) f1 |= 0x01; if (ClientId != null && ClientIdBytes == null) f1 |= 0x02; if (Destination != null) f1 |= 0x04; if (Headers != null) f1 |= 0x08; if (MessageId != null && MessageIdBytes == null) f1 |= 0x10; if (Timestamp != 0) f1 |= 0x20; if (TimeToLive != 0) f1 |= 0x40; byte f2 = 0; if (ClientIdBytes != null) f2 |= 0x01; if (MessageIdBytes != null) f2 |= 0x02; if (f2 != 0) f1 |= 0x80; output.WriteByte(f1); if ((f1&0x80) != 0) output.WriteByte(f2); if (Body != null) output.WriteObject(Body); if (ClientId != null && ClientIdBytes == null) output.WriteObject(ClientId); if (Destination != null) output.WriteObject(Destination); if (Headers != null) output.WriteObject(Headers); if (MessageId != null && MessageIdBytes == null) output.WriteObject(MessageId); if (Timestamp != 0) output.WriteObject(Timestamp); if (TimeToLive != 0) output.WriteObject(TimeToLive); if (ClientIdBytes != null) output.WriteObject(ClientIdBytes); if (MessageIdBytes != null) output.WriteObject(MessageIdBytes); byte f3 = 0; if (CorrelationId != null && CorrelationIdBytes == null) f3 |= 0x01; if (CorrelationIdBytes != null) f3 |= 0x02; output.WriteByte(f3); if (CorrelationId != null && CorrelationIdBytes == null) output.WriteObject(CorrelationId); if (CorrelationIdBytes != null) output.WriteObject(CorrelationIdBytes); }
private void ProcessWriteAsyncMessage(IDataOutput output) { ProcessWriteAbstractMessage(output); if (!String.IsNullOrEmpty(CorrelationId) || correlationIdBytes != null) { // write correlation id bytes if (correlationIdBytes == null) { byte[] corBytes = AmfMessageUtils.UIDStringToBytes(CorrelationId); correlationIdBytes.WriteBytes(corBytes); } // CORRELATION_ID_BYTES_FLAG output.WriteByte(0x2); output.WriteObject(correlationIdBytes); } }
private void ProcessWriteAcknowledgeMessage(IDataOutput output) { ProcessWriteAsyncMessage(output); output.WriteByte(0); }
private void ProcessWriteAbstractMessage(IDataOutput output) { byte flag = 0; if (Body != null) flag |= (int)PartFlags.BODY_FLAG; if (!String.IsNullOrEmpty(Destination)) flag |= (int)PartFlags.DESTINATION_FLAG; if (Headers != null && Headers.Any()) flag |= (int)PartFlags.HEADERS_FLAG; if (Timestamp != 0) flag |= (int)PartFlags.TIMESTAMP_FLAG; if (TimeToLive != 0) flag |= (int)PartFlags.TIME_TO_LIVE_FLAG; if (ClientId != null || !String.IsNullOrEmpty(MessageId)) flag |= (int)PartFlags.HAS_NEXT_FLAG; output.WriteByte(flag); byte flag2 = 0; if (ClientId != null || clientIdBytes != null) { // write correlation id bytes if (clientIdBytes == null) { byte[] cBytes = AmfMessageUtils.UIDStringToBytes((string)ClientId); clientIdBytes = new ByteArray(); clientIdBytes.WriteBytes(cBytes); } flag2 |= 0x1; } if (MessageId != null || messageIdBytes != null) { // write correlation id bytes if (messageIdBytes == null) { byte[] cBytes = AmfMessageUtils.UIDStringToBytes((string)MessageId); messageIdBytes = new ByteArray(); messageIdBytes.WriteBytes(cBytes); } flag2 |= 0x2; } if (flag2 != 0) output.WriteByte(flag2); if (Body != null) output.WriteObject(Body); if (!String.IsNullOrEmpty(Destination)) output.WriteObject(Destination); if (Headers != null && Headers.Any()) output.WriteObject(Headers); if (Timestamp != 0) output.WriteObject(Timestamp); if (TimeToLive != 0) output.WriteObject(TimeToLive); if (clientIdBytes != null) output.WriteObject(clientIdBytes); if (messageIdBytes != null) output.WriteObject(messageIdBytes); }
public virtual void WriteExternal(IDataOutput output) { if (ClientIdBytes == null) { ClientIdBytes = RtmpUtil.ToByteArray(ClientId); } if (MessageIdBytes == null) { MessageIdBytes = RtmpUtil.ToByteArray(MessageId); } int firstflags = 0; if (Body != null) { firstflags |= BODY_FLAG; } if (ClientId != null && ClientIdBytes == null) { firstflags |= CLIENT_ID_FLAG; } if (Destination != null) { firstflags |= DESTINATION_FLAG; } if (Headers != null) { firstflags |= HEADERS_FLAG; } if (MessageId != null && MessageIdBytes == null) { firstflags |= MESSAGE_ID_FLAG; } if (TimeStamp != 0) { firstflags |= TIMESTAMP_FLAG; } if (TimeToLive != 0) { firstflags |= TIME_TO_LIVE_FLAG; } int secondflags = 0; if (ClientIdBytes != null) { secondflags |= CLIENT_ID_BYTES_FLAG; } if (MessageIdBytes != null) { secondflags |= MESSAGE_ID_BYTES_FLAG; } if (secondflags != 0) { firstflags |= HAS_NEXT_FLAG; } output.WriteByte((byte)firstflags); if (secondflags != 0) { output.WriteByte((byte)secondflags); } if (Body != null) { output.WriteObject(Body); } if (ClientId != null && ClientIdBytes == null) { output.WriteObject(ClientId); } if (Destination != null) { output.WriteObject(Destination); } if (Headers != null) { output.WriteObject(Headers); } if (MessageId != null && MessageIdBytes == null) { output.WriteObject(MessageId); } if (TimeStamp != 0) { output.WriteObject(TimeStamp); } if (TimeToLive != 0) { output.WriteObject(TimeToLive); } if (ClientIdBytes != null) { output.WriteObject(ClientIdBytes); } if (MessageIdBytes != null) { output.WriteObject(MessageIdBytes); } }
public new void WriteExternal(IDataOutput output) { base.WriteExternal(output); if (correlationIdBytes == null && correlationId != null) correlationIdBytes = new Guid(correlationId).ToByteArray(); byte flags = 0; if (correlationId != null && correlationIdBytes == null) flags |= CORRELATION_ID_FLAG; if (correlationIdBytes != null) flags |= CORRELATION_ID_BYTES_FLAG; output.WriteByte(flags); if (correlationId != null && correlationIdBytes == null) output.WriteObject(correlationId); if (correlationIdBytes != null) output.WriteObject(correlationIdBytes); }
/// <summary> /// 写入一个带符号 8 位数字. /// </summary> /// <param name="output">输出流对象.</param> /// <param name="value">要写入的数据.</param> public static void WriteByte(IDataOutput output, sbyte value) { output.WriteByte(value); }
public virtual void WriteExternal(IDataOutput output) { byte f1 = 0; if (Body != null) { f1 |= 0x01; } if (ClientId != null && ClientIdBytes == null) { f1 |= 0x02; } if (Destination != null) { f1 |= 0x04; } if (Headers != null) { f1 |= 0x08; } if (MessageId != null && MessageIdBytes == null) { f1 |= 0x10; } if (Timestamp != 0) { f1 |= 0x20; } if (TimeToLive != 0) { f1 |= 0x40; } byte f2 = 0; if (ClientIdBytes != null) { f2 |= 0x01; } if (MessageIdBytes != null) { f2 |= 0x02; } if (f2 != 0) { f1 |= 0x80; } output.WriteByte(f1); if ((f1 & 0x80) != 0) { output.WriteByte(f2); } if (Body != null) { output.WriteObject(Body); } if (ClientId != null && ClientIdBytes == null) { output.WriteObject(ClientId); } if (Destination != null) { output.WriteObject(Destination); } if (Headers != null) { output.WriteObject(Headers); } if (MessageId != null && MessageIdBytes == null) { output.WriteObject(MessageId); } if (Timestamp != 0) { output.WriteObject(Timestamp); } if (TimeToLive != 0) { output.WriteObject(TimeToLive); } if (ClientIdBytes != null) { output.WriteObject(ClientIdBytes); } if (MessageIdBytes != null) { output.WriteObject(MessageIdBytes); } byte f3 = 0; if (CorrelationId != null && CorrelationIdBytes == null) { f3 |= 0x01; } if (CorrelationIdBytes != null) { f3 |= 0x02; } output.WriteByte(f3); if (CorrelationId != null && CorrelationIdBytes == null) { output.WriteObject(CorrelationId); } if (CorrelationIdBytes != null) { output.WriteObject(CorrelationIdBytes); } }
public override void WriteExternal(IDataOutput output) { base.WriteExternal(output); output.WriteByte(0); }
/** * * * 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.writeExternal(ObjectOutput) * to efficiently serialize the properties for this abstract base class. */ public void WriteExternal(IDataOutput output) { short flags = 0; if (clientIdBytes == null && clientId != null && clientId is string) { clientIdBytes = new Guid((string)clientId).ToByteArray(); } if (messageIdBytes == null && messageId != null) { messageIdBytes = new Guid(messageId).ToByteArray(); } if (body != null) { flags |= BODY_FLAG; } if (clientId != null && clientIdBytes == null) { flags |= CLIENT_ID_FLAG; } if (destination != null) { flags |= DESTINATION_FLAG; } if (headers != null) { flags |= HEADERS_FLAG; } if (messageId != null && messageIdBytes == null) { flags |= MESSAGE_ID_FLAG; } if (timestamp != 0) { flags |= TIMESTAMP_FLAG; } if (timeToLive != 0) { flags |= TIME_TO_LIVE_FLAG; } if (clientIdBytes != null || messageIdBytes != null) { flags |= HAS_NEXT_FLAG; } output.WriteByte((byte)flags); flags = 0; if (clientIdBytes != null) { flags |= CLIENT_ID_BYTES_FLAG; } if (messageIdBytes != null) { flags |= MESSAGE_ID_BYTES_FLAG; } if (flags != 0) { output.WriteByte((byte)flags); } if (body != null) { WriteExternalBody(output); } if (clientId != null && clientIdBytes == null) { output.WriteObject(clientId); } if (destination != null) { output.WriteObject(destination); } if (headers != null) { output.WriteObject(headers); } if (messageId != null && messageIdBytes == null) { output.WriteObject(messageId); } if (timestamp != 0) { output.WriteObject(timestamp); } if (timeToLive != 0) { output.WriteObject(timeToLive); } if (clientIdBytes != null) { output.WriteObject(clientIdBytes); } if (messageIdBytes != null) { output.WriteObject(messageIdBytes); } }
public virtual void WriteExternal(IDataOutput output) { byte num1 = 0; if (this.Body != null) { num1 |= (byte)1; } if (this.ClientId != null && this.ClientIdBytes == null) { num1 |= (byte)2; } if (this.Destination != null) { num1 |= (byte)4; } if (this.Headers != null) { num1 |= (byte)8; } if (this.MessageId != null && this.MessageIdBytes == null) { num1 |= (byte)16; } if (this.Timestamp != 0L) { num1 |= (byte)32; } if (this.TimeToLive != 0L) { num1 |= (byte)64; } byte num2 = 0; if (this.ClientIdBytes != null) { num2 |= (byte)1; } if (this.MessageIdBytes != null) { num2 |= (byte)2; } if ((int)num2 != 0) { num1 |= (byte)128; } output.WriteByte(num1); if (((int)num1 & 128) != 0) { output.WriteByte(num2); } if (this.Body != null) { output.WriteObject(this.Body); } if (this.ClientId != null && this.ClientIdBytes == null) { output.WriteObject((object)this.ClientId); } if (this.Destination != null) { output.WriteObject((object)this.Destination); } if (this.Headers != null) { output.WriteObject((object)this.Headers); } if (this.MessageId != null && this.MessageIdBytes == null) { output.WriteObject((object)this.MessageId); } if (this.Timestamp != 0L) { output.WriteObject((object)this.Timestamp); } if (this.TimeToLive != 0L) { output.WriteObject((object)this.TimeToLive); } if (this.ClientIdBytes != null) { output.WriteObject((object)this.ClientIdBytes); } if (this.MessageIdBytes != null) { output.WriteObject((object)this.MessageIdBytes); } byte num3 = 0; if (this.CorrelationId != null && this.CorrelationIdBytes == null) { num3 |= (byte)1; } if (this.CorrelationIdBytes != null) { num3 |= (byte)2; } output.WriteByte(num3); if (this.CorrelationId != null && this.CorrelationIdBytes == null) { output.WriteObject((object)this.CorrelationId); } if (this.CorrelationIdBytes == null) { return; } output.WriteObject((object)this.CorrelationIdBytes); }
public new void WriteExternal(IDataOutput output) { base.WriteExternal(output); byte flags = 0; if (operation != 0) flags |= OPERATION_FLAG; output.WriteByte(flags); if (operation != 0) output.WriteObject(operation); }
public virtual void WriteExternal(IDataOutput output) { if (ClientIdBytes == null) ClientIdBytes = RtmpUtil.ToByteArray(ClientId); if (MessageIdBytes == null) MessageIdBytes = RtmpUtil.ToByteArray(MessageId); int firstflags = 0; if (Body != null) firstflags |= BODY_FLAG; if (ClientId != null && ClientIdBytes == null) firstflags |= CLIENT_ID_FLAG; if (Destination != null) firstflags |= DESTINATION_FLAG; if (Headers != null) firstflags |= HEADERS_FLAG; if (MessageId != null && MessageIdBytes == null) firstflags |= MESSAGE_ID_FLAG; if (TimeStamp != 0) firstflags |= TIMESTAMP_FLAG; if (TimeToLive != 0) firstflags |= TIME_TO_LIVE_FLAG; int secondflags = 0; if (ClientIdBytes != null) secondflags |= CLIENT_ID_BYTES_FLAG; if (MessageIdBytes != null) secondflags |= MESSAGE_ID_BYTES_FLAG; if (secondflags != 0) firstflags |= HAS_NEXT_FLAG; output.WriteByte((byte)firstflags); if (secondflags != 0) output.WriteByte((byte)secondflags); if (Body != null) output.WriteObject(Body); if (ClientId != null && ClientIdBytes == null) output.WriteObject(ClientId); if (Destination != null) output.WriteObject(Destination); if (Headers != null) output.WriteObject(Headers); if (MessageId != null && MessageIdBytes == null) output.WriteObject(MessageId); if (TimeStamp != 0) output.WriteObject(TimeStamp); if (TimeToLive != 0) output.WriteObject(TimeToLive); if (ClientIdBytes != null) output.WriteObject(ClientIdBytes); if (MessageIdBytes != null) output.WriteObject(MessageIdBytes); }
public override void WriteExternal(IDataOutput output) { base.WriteExternal(output); int flags = 0; if (Operation != 0) flags |= OPERATION_FLAG; output.WriteByte((byte)flags); if (Operation != 0) output.WriteObject(Operation); }