GetSegment() private method

private GetSegment ( ) : ArraySegment
return ArraySegment
コード例 #1
0
ファイル: MessageWriter.cs プロジェクト: tmds/Tmds.SockJS
        public static ArraySegment<byte> CreateSendsMessage(ReceiverType type, List<PendingSend> sends)
        {
            MessageWriter writer = new MessageWriter();
            writer.WriteSends(sends);
            ArraySegment<byte> sendsSegment = writer.GetSegment();

            if (type != ReceiverType.HtmlFile)
            {
                return sendsSegment;
            }
            else
            {
                MessageWriter htmlFileWriter = new MessageWriter();
                htmlFileWriter.WriteBytes(s_htmlFileSendMessagesStart);
                htmlFileWriter.WriteJsonString(new ArraySegment<byte>(sendsSegment.Array, sendsSegment.Offset, sendsSegment.Count - 1));
                htmlFileWriter.WriteBytes(s_htmlFileSendMessagesEnd);
                return htmlFileWriter.GetSegment();
            }
        }
コード例 #2
0
ファイル: MessageWriter.cs プロジェクト: tmds/Tmds.SockJS
 public static ArraySegment<byte> CreateSockJSWebSocketSendMessage(ArraySegment<byte> buffer)
 {
     MessageWriter writer = new MessageWriter();
     writer.WriteSockJSWebSocketSend(buffer);
     return writer.GetSegment();
 }