本文整理汇总了C#中RabbitMQ.Util.NetworkBinaryWriter.Write方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkBinaryWriter.Write方法的具体用法?C# NetworkBinaryWriter.Write怎么用?C# NetworkBinaryWriter.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RabbitMQ.Util.NetworkBinaryWriter
的用法示例。
在下文中一共展示了NetworkBinaryWriter.Write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
public static void Write(NetworkBinaryWriter writer, byte[] source, int offset, int count)
{
writer.Write(source, offset, count);
}
示例2: WriteShort
public static void WriteShort(NetworkBinaryWriter writer, ushort val)
{
writer.Write((ushort)val);
}
示例3: WriteTable
///<summary>Writes an AMQP "table" to the writer.</summary>
///<remarks>
///<para>
/// In this method, we assume that the stream that backs our
/// NetworkBinaryWriter is a positionable stream - which it is
/// currently (see Frame.m_accumulator, Frame.GetWriter and
/// Command.Transmit).
///</para>
///<para>
/// Supports the AMQP 0-8/0-9 standard entry types S, I, D, T
/// and F, as well as the QPid-0-8 specific b, d, f, l, s, t
/// x and V types and the AMQP 0-9-1 A type.
///</para>
///</remarks>
public static void WriteTable(NetworkBinaryWriter writer, IDictionary val)
{
if (val == null)
{
writer.Write((uint)0);
}
else
{
Stream backingStream = writer.BaseStream;
long patchPosition = backingStream.Position;
writer.Write((uint)0); // length of table - will be backpatched
foreach (DictionaryEntry entry in val)
{
WriteShortstr(writer, (string)entry.Key);
object value = entry.Value;
WriteFieldValue(writer, value);
}
// Now, backpatch the table length.
long savedPosition = backingStream.Position;
long tableLength = savedPosition - patchPosition - 4; // offset for length word
backingStream.Seek(patchPosition, SeekOrigin.Begin);
writer.Write((uint)tableLength);
backingStream.Seek(savedPosition, SeekOrigin.Begin);
}
}
示例4: WriteLong
public static void WriteLong(NetworkBinaryWriter writer, uint val)
{
writer.Write((uint)val);
}
示例5: WriteLongstr
public static void WriteLongstr(NetworkBinaryWriter writer, byte[] val)
{
WriteLong(writer, (uint)val.Length);
writer.Write(val);
}
示例6: WriteString
public static void WriteString(NetworkBinaryWriter writer, string value) {
writer.Write((byte) StreamWireFormattingTag.String);
WriteUntypedString(writer, value);
}
示例7: WriteArray
public static void WriteArray(NetworkBinaryWriter writer, IList val)
{
if (val == null)
{
writer.Write((uint)0);
}
else
{
Stream backingStream = writer.BaseStream;
long patchPosition = backingStream.Position;
writer.Write((uint)0); // length of table - will be backpatched
foreach (object entry in val)
{
WriteFieldValue(writer, entry);
}
long savedPosition = backingStream.Position;
long tableLength = savedPosition - patchPosition - 4; // offset for length word
backingStream.Seek(patchPosition, SeekOrigin.Begin);
writer.Write((uint)tableLength);
backingStream.Seek(savedPosition, SeekOrigin.Begin);
}
}
示例8: WriteInt64
public static void WriteInt64(NetworkBinaryWriter writer, long value)
{
writer.Write(value);
}
示例9: WriteSingle
public static void WriteSingle(NetworkBinaryWriter writer, float value)
{
writer.Write(value);
}
示例10: WriteInt16
public static void WriteInt16(NetworkBinaryWriter writer, short value)
{
writer.Write(value);
}
示例11: WriteInt32
public static void WriteInt32(NetworkBinaryWriter writer, int value)
{
writer.Write(value);
}
示例12: WriteDouble
public static void WriteDouble(NetworkBinaryWriter writer, double value)
{
writer.Write(value);
}
示例13: WriteChar
public static void WriteChar(NetworkBinaryWriter writer, char value)
{
writer.Write((ushort) value);
}
示例14: WriteByte
public static void WriteByte(NetworkBinaryWriter writer, byte value)
{
writer.Write(value);
}
示例15: WriteDouble
public static void WriteDouble(NetworkBinaryWriter writer, double value) {
writer.Write((byte) StreamWireFormattingTag.Double);
writer.Write(value);
}