Beispiel #1
0
        public static void WritePacket(IMessage message, Stream output)
        {
            ByteBuilder buffer    = new ByteBuilder();
            var         outStream = new ByteStream(buffer);

            buffer.AddDelimited(message);
            buffer.CopyTo(output);
        }
Beispiel #2
0
        public ByteStream ReadStream(int size)
        {
            ByteBuilder innerBuilder = new ByteBuilder(m_Buffer, m_ReadPos, m_ReadPos + size);
            ByteStream  ret          = new ByteStream(innerBuilder, true, false);

            m_ReadPos += size;
            return(ret);
        }
Beispiel #3
0
 public static bool TryGetPacket(ByteBuilder input, out ByteStream output)
 {
     output = null;
     return(input.TryReadStreamDelimited(ref output));
 }
Beispiel #4
0
 public ByteBuilder(ByteBuilder src)
 {
     this.m_Buffer   = src.m_Buffer;
     this.m_ReadPos  = src.m_ReadPos;
     this.m_WritePos = src.m_WritePos;
 }
Beispiel #5
0
 public ByteStream(ByteBuilder baseBuilder, bool canRead, bool canWrite)
 {
     m_Builder  = baseBuilder;
     m_canRead  = canRead;
     m_canWrite = canWrite;
 }
Beispiel #6
0
 public ByteStream(ByteBuilder baseBuilder)
 {
     m_Builder  = baseBuilder;
     m_canRead  = true;
     m_canWrite = true;
 }