Fan.Sys.Uri.Decoder.nextChar C# (CSharp) Method

nextChar() private method

private nextChar ( int section ) : int
section int
return int
            private int nextChar(int section)
            {
                int c = nextOctet(section);
                if (c < 0) return -1;
                int c2, c3;
                switch (c >> 4)
                {
                  case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
                /* 0xxxxxxx*/
                return c;
                  case 12: case 13:
                /* 110x xxxx   10xx xxxx*/
                c2 = nextOctet(section);
                if ((c2 & 0xC0) != 0x80)
                  throw err("Invalid UTF-8 encoding");
                return ((c & 0x1F) << 6) | (c2 & 0x3F);
                  case 14:
                /* 1110 xxxx  10xx xxxx  10xx xxxx */
                c2 = nextOctet(section);
                c3 = nextOctet(section);
                if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80))
                  throw err("Invalid UTF-8 encoding");
                return (((c & 0x0F) << 12) | ((c2 & 0x3F) << 6) | ((c3 & 0x3F) << 0));
                  default:
                throw err("Invalid UTF-8 encoding");
                }
            }