当前位置: 首页>>代码示例>>C#>>正文


C# ByteReader.Next方法代码示例

本文整理汇总了C#中ByteReader.Next方法的典型用法代码示例。如果您正苦于以下问题:C# ByteReader.Next方法的具体用法?C# ByteReader.Next怎么用?C# ByteReader.Next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ByteReader的用法示例。


在下文中一共展示了ByteReader.Next方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read

        public unsafe byte* Read(ByteReader r, HttpRawRequest request)
        {
            // field-value = *( field-content / obs-fold )
            // field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
            // field-vchar = VCHAR / obs-text
            // obs-fold = CRLF 1*( SP / HTAB )
            // obs-text = %x80-FF

            byte* pValueEnd = r.Position;
            while (r.Next().IsVcharOrObsTextOrSpaceOrTab())
                if (!r.Current.IsSpaceOrHtab())
                    pValueEnd = r.Position;

            byte c = r.Current;

            if (c == '\r' && r.Next() == '\n')
                return pValueEnd;
            throw new BadRequestException();
        }
开发者ID:ts2do,项目名称:Kx.Web,代码行数:19,代码来源:GenericHeaderReader.cs

示例2: Read

        public byte* Read(ByteReader r, HttpRawRequest request)
        {
            // Transfer-Encoding = *( "," OWS ) transfer-coding *( OWS "," [ OWS transfer-coding ] )
            // transfer-coding = "chunked" / "compress" / "deflate" / "gzip" / transfer-extension
            // transfer-extension = token *( OWS ";" OWS transfer-parameter )
            // transfer-parameter = token BWS "=" BWS ( token / quoted-string )

            int hashCode = 0;
            byte c = r.Current;
            byte mappedC = c.MapTchar();
            if (mappedC != 0 || c == ',')
            {
                while (true)
                {
                    if (c == ',')
                    {
                        // skip '*( "," OWS )'
                        do
                        {
                            c = r.Next();
                        } while (c == ',' || c.IsSpaceOrHtab());

                        mappedC = c.MapTchar();
                    }

                    if (mappedC != c)
                    {
                        if (c == '\r')
                        {
                            if (r.Next() == '\n')
                            {
                                // TODO: return correct pointers
                                throw new NotImplementedException();
                            }
                            throw new BadRequestException();
                        }

                        if (mappedC == 0)
                            throw new BadRequestException();
                        r.ReplaceCurrent(mappedC);
                    }

                    // read 'token'
                    var tc = new TransferCoding();
                    tc.Name.Value.Start = r.Position;
                    do
                    {
                        hashCode = NativeByteArray.MixHash(hashCode, c = r.Next());
                    } while (c.IsTchar());

                    tc.Name.HashCode = hashCode;
                    tc.Name.Value.End = r.Position;

                    while (c.IsSpaceOrHtab())
                        c = r.Next();

                    if (c == '\r')
                    {
                        if (r.Next() == '\n')
                        {
                            // TODO: return correct pointers
                            throw new NotImplementedException();
                        }
                        throw new BadRequestException();
                    }

                    if (c == ';')
                    {
                        do
                        {
                            c = r.Next();
                        } while (c.IsSpaceOrHtab());

                        do
                        {
                            // TODO: read token
                            if (c.IsSpaceOrHtab())
                            {
                                do
                                {
                                    c = r.Next();
                                } while (c.IsSpaceOrHtab());
                            }
                            if (c != '=')
                                throw new BadRequestException();
                            do
                            {
                                c = r.Next();
                            } while (c.IsSpaceOrHtab());
                            // TODO: read token or quoted-string
                            if (c.IsSpaceOrHtab())
                            {
                                // TODO: save off pPos before whitespace
                                do
                                {
                                    c = r.Next();
                                } while (c.IsSpaceOrHtab());
                            }
                        } while (c == ';');
                    }
//.........这里部分代码省略.........
开发者ID:ts2do,项目名称:Kx.Web,代码行数:101,代码来源:TransferEncodingHeaderReader.cs


注:本文中的ByteReader.Next方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。