Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public static bool TryGetPacket(ByteBuilder input, out ByteStream output)
 {
     output = null;
     return(input.TryReadStreamDelimited(ref output));
 }
Ejemplo n.º 4
0
 public ByteBuilder(ByteBuilder src)
 {
     this.m_Buffer   = src.m_Buffer;
     this.m_ReadPos  = src.m_ReadPos;
     this.m_WritePos = src.m_WritePos;
 }
Ejemplo n.º 5
0
 public ByteStream(ByteBuilder baseBuilder, bool canRead, bool canWrite)
 {
     m_Builder  = baseBuilder;
     m_canRead  = canRead;
     m_canWrite = canWrite;
 }
Ejemplo n.º 6
0
 public ByteStream(ByteBuilder baseBuilder)
 {
     m_Builder  = baseBuilder;
     m_canRead  = true;
     m_canWrite = true;
 }