private int nextOctet(int section)
{
int c = str[dpos++];
// if percent encoded applied to all sections except
// scheme which should never never use this method
if (c == '%')
{
nextCharWasEscaped = true;
return (hexNibble(str[dpos++]) << 4) | hexNibble(str[dpos++]);
}
else
{
nextCharWasEscaped = false;
}
// + maps to space only in query
if (c == '+' && section == QUERY)
return ' ';
// verify character ok
if (c >= charMap.Length || (charMap[c] & section) == 0)
throw err("Invalid char in " + toSection(section) + " at index " + (dpos-1));
// return character as is
return c;
}