Read the next token and interpret it as a 16-bit unsigned
        integer.

        @raises dns.exception.SyntaxError:
        @rtype: int
552244
def get_uint16(self):
        

        value = self.get_int()
        if value < 0 or value > 65535:
            raise dns.exception.SyntaxError('%d is not an unsigned 16-bit integer' % value)
        return value
795526
def read(self, b=-1):
        
        remaining_bytes = b
        data = io.BytesIO()
        while True:
            try:
                chunk = to_bytes(self.__wrapped__.read(remaining_bytes))
            except ValueError:
                if self.__wrapped__.closed:
                    break
                raise

            if not chunk:
                break

            data.write(chunk)
            remaining_bytes -= len(chunk)

            if remaining_bytes <= 0:
                break
        return data.getvalue()
1197118
def read(self):
        

        try:
            while 1:
                token = self.tok.get(True, True).unescape()
                if token.is_eof():
                    if not self.current_file is None:
                        self.current_file.close()
                    if len(self.saved_state) > 0:
                        (self.tok,
                         self.current_origin,
                         self.last_name,
                         self.current_file,
                         self.ttl) = self.saved_state.pop(-1)
                        continue
                    break
                elif token.is_eol():
                    continue
                elif token.is_comment():
                    self.tok.get_eol()
                    continue
                elif token.value[0] == '$':
                    u = token.value.upper()
                    if u == '$TTL':
                        token = self.tok.get()
                        if not token.is_identifier():
                            raise dns.exception.SyntaxError("bad $TTL")
                        self.ttl = dns.ttl.from_text(token.value)
                        self.tok.get_eol()
                    elif u == '$ORIGIN':
                        self.current_origin = self.tok.get_name()
                        self.tok.get_eol()
                        if self.zone.origin is None:
                            self.zone.origin = self.current_origin
                    elif u == '$INCLUDE' and self.allow_include:
                        token = self.tok.get()
                        if not token.is_quoted_string():
                            raise dns.exception.SyntaxError("bad filename in $INCLUDE")
                        filename = token.value
                        token = self.tok.get()
                        if token.is_identifier():
                            new_origin = dns.name.from_text(token.value, \
                                                            self.current_origin)
                            self.tok.get_eol()
                        elif not token.is_eol_or_eof():
                            raise dns.exception.SyntaxError("bad origin in $INCLUDE")
                        else:
                            new_origin = self.current_origin
                        self.saved_state.append((self.tok,
                                                 self.current_origin,
                                                 self.last_name,
                                                 self.current_file,
                                                 self.ttl))
                        self.current_file = file(filename, 'r')
                        self.tok = dns.tokenizer.Tokenizer(self.current_file,
                                                           filename)
                        self.current_origin = new_origin
                    else:
                        raise dns.exception.SyntaxError("Unknown master file directive '" + u + "'")
                    continue
                self.tok.unget(token)
                self._rr_line()
        except dns.exception.SyntaxError, detail:
            (filename, line_number) = self.tok.where()
            if detail is None:
                detail = "syntax error"
            raise dns.exception.SyntaxError("%s:%d: %s" % (filename, line_number, detail))

        # Now that we're done reading, do some basic checking of the zone.
        if self.check_origin:
            self.zone.check_origin()
244806
def unpack_float16(src):
    
    bc = BitConsumer(src)
    sign = bc.u_get(1)
    exponent = bc.u_get(5)
    mantissa = bc.u_get(10)
    exponent -= 16
    mantissa /= 2 ** 10
    num = (-1 ** sign) * mantissa * (10 ** exponent)
    return num
1160435
def read_uint16(self, little_endian=True):
        
        if little_endian:
            endian = "<"
        else:
            endian = ">"
        return self.unpack('%sH' % endian, 2)
496669
public int readInt()
        throws IOException
    {
        int tag = read();

        switch (tag) {
            case 'T':
                return 1;
            case 'F':
                return 0;
            case 'I':
                return parseInt();
            case 'L':
                return (int) parseLong();
            case 'D':
                return (int) parseDouble();

            default:
                throw expect("int", tag);
        }
    }
407280
def read_bit(self):
        
        # Perform a faster check on underflow
        if self._pos >= self._end_pos:
            raise self.BufferUnderflow()
        result = ord(self._input[self._pos]) & 1
        self._pos += 1
        return result
363537
def read(self, n=-1):
        

        buf = b''
        while n < 0 or n is None or n > len(buf):
            data = self.read1(n)
            if len(data) == 0:
                return buf

            buf += data

        return buf
675631
def read_int_sval(s)
      s = s.downcase
      if s.match(/^[+-]?0x/)
        return s.to_i(16)
      end
      if s.match(/^[+-]?0b/)
        return s.to_i(2)
      end
      if s.match(/^[+-]?0/)
        return s.to_i(8)
      end
      s.to_i(10)
    end
428362
def get_int(self):
        

        token = self.get().unescape()
        if not token.is_identifier():
            raise dns.exception.SyntaxError('expecting an identifier')
        if not token.value.isdigit():
            raise dns.exception.SyntaxError('expecting an integer')
        return int(token.value)
628113
def read_varint32(self):
        
        i = self.read_varint64()
        if not wire_format.INT32_MIN <= i <= wire_format.INT32_MAX:
            raise errors.DecodeError('Value out of range for int32: %d' % i)
        return int(i)
949667
def read_json_integer
      @context.read(@reader)
      if (@context.escapeNum)
        read_json_syntax_char(@@kJSONStringDelimiter)
      end
      str = read_json_numeric_chars

      begin
        num = Integer(str);
      rescue
        raise ProtocolException.new(ProtocolException::INVALID_DATA, "Expected numeric value; got \"#{str}\"")
      end

      if (@context.escapeNum)
        read_json_syntax_char(@@kJSONStringDelimiter)
      end

      return num
    end
940227
public int readInt()
    throws IOException
  {
    if (_readOffset + 4 < _readLength) {
      return (((_readBuffer[_readOffset++] & 0xff) << 24)
              + ((_readBuffer[_readOffset++] & 0xff) << 16)
              + ((_readBuffer[_readOffset++] & 0xff) << 8)
              + ((_readBuffer[_readOffset++] & 0xff)));
    }
    else {
      return ((read() << 24)
              + (read() << 16)
              + (read() << 8)
              + (read()));
    }
  }
188939
def read_binary_int(fname,fd,length)
      if length > 4
        raise CFFormatError.new("Integer greater than 16 bytes: #{length}")
      end

      nbytes = 1 << length

      buff = fd.read(nbytes)

      CFInteger.new(
        case length
        when 0 then buff.unpack("C")[0]
        when 1 then buff.unpack("n")[0]
        when 2 then buff.unpack("N")[0]
        # 8 byte integers are always signed
        when 3 then buff.unpack("q>")[0]
        # 16 byte integers are used to represent unsigned 8 byte integers
        # where the unsigned value is stored in the lower 8 bytes and the
        # upper 8 bytes are unused.
        when 4 then buff.unpack("Q>Q>")[1]
        end
      )
    end
1299191
def read(self, num_bytes=None):
        """"""
        res = self.get_next(num_bytes)
        self.skip(len(res))
        return res
1292367
public int
readU16() throws WireParseException {
	require(2);
	int b1 = array[pos++] & 0xFF;
	int b2 = array[pos++] & 0xFF;
	return ((b1 << 8) + b2);
}
898581
def integer(token):
        
        token = token.strip()
        neg = False
        if token.startswith(compat.b('-')):
            token = token[1:]
            neg = True
        if token.startswith(compat.b('0x')):
            result = int(token, 16)     # hexadecimal
        elif token.startswith(compat.b('0b')):
            result = int(token[2:], 2)  # binary
        elif token.startswith(compat.b('0o')):
            result = int(token, 8)      # octal
        else:
            try:
                result = int(token)     # decimal
            except ValueError:
                result = int(token, 16) # hexadecimal (no "0x" prefix)
        if neg:
            result = -result
        return result