Read a 32-bit little-endian integer from the internal buffer.
14136
public int readRawLittleEndian32() throws IOException
    {
        // final byte[] buffer = this.buffer;
        // int offset = this.offset;

        final byte[] bs = new byte[4];
        buffer.get(bs);

        // final byte b1 = buffer[offset++];
        // final byte b2 = buffer[offset++];
        // final byte b3 = buffer[offset++];
        // final byte b4 = buffer[offset++];
        //
        // this.offset = offset;

        return (((int) bs[0] & 0xff)) |
                (((int) bs[1] & 0xff) << 8) |
                (((int) bs[2] & 0xff) << 16) |
                (((int) bs[3] & 0xff) << 24);
    }
1328570
public static int readIntegerLittleEndian(InputStream io) throws IOException {
		int value = io.read();
		if (value < 0) throw new EOFException();
		int i = io.read();
		if (i < 0) throw new EOFException();
		value |= i << 8;
		i = io.read();
		if (i < 0) throw new EOFException();
		value |= i << 16;
		i = io.read();
		if (i < 0) throw new EOFException();
		value |= i << 24;
		return value;
	}
1315589
def _readbin(self, length, start):
        """"""
        if not length:
            return ''
        # Get the byte slice containing our bit slice
        startbyte, startoffset = divmod(start + self._offset, 8)
        endbyte = (start + self._offset + length - 1) // 8
        b = self._datastore.getbyteslice(startbyte, endbyte + 1)
        # Convert to a string of '0' and '1's (via a hex string an and int!)
        try:
            c = "{:0{}b}".format(int(binascii.hexlify(b), 16), 8*len(b))
        except TypeError:
            # Hack to get Python 2.6 working
            c = "{0:0{1}b}".format(int(binascii.hexlify(str(b)), 16), 8*len(b))
        # Finally chop off any extra bits.
        return c[startoffset:startoffset + length]
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
4070
function readInteger(width, reader) {
    return function (start, cb) {
      var i = Math.floor(start/block_size)
      var _i = start%block_size

      //if the UInt32BE aligns with in a block
      //read directly and it's 3x faster.
      if(_i < block_size - width)
        get(i, function (err, block) {
          if(err) return cb(err)
          var value = reader(block, start%block_size)
          cb(null, value)
        })
      //but handle overlapping reads this easier way
      //instead of messing around with bitwise ops
      else
        read(start, start+width, function (err, buf, bytes_read) {
          if(err) return cb(err)
          var value = reader(buf, 0);
          cb(isNaN(value) ? new Error('Number is too large') : null, value)
        })
    }
  }
233857
def read_little_endian32(self):
        
        try:
            i = struct.unpack(wire_format.FORMAT_UINT32_LITTLE_ENDIAN,
                              self._input.read(4))
            self._pos += 4
            return i[0]  # unpack() result is a 1-element tuple.
        except struct.error as e:
            raise errors.DecodeError(e)
850724
public static long readUnsignedIntegerBigEndian(byte[] buffer, int offset) {
		long value;
		value = (buffer[offset + 3] & 0xFF);
		value |= (buffer[offset + 2] & 0xFF) << 8;
		value |= (buffer[offset + 1] & 0xFF) << 16;
		value |= ((long)(buffer[offset] & 0xFF)) << 24;
		return value;
	}
987638
function readInt32W(buffer, offset, isBigEndian, noAssert) {
  var neg, val;

  if (!noAssert) {
    assert.ok(typeof (isBigEndian) === 'boolean',
        'missing or invalid endian');

    assert.ok(offset !== undefined && offset !== null,
        'missing offset');

    assert.ok(offset + 3 < buffer.length,
        'Trying to read beyond buffer length');
  }

  val = readUInt32W(buffer, offset, isBigEndian, noAssert);
  neg = val & 0x80000000;
  if (!neg) {
    return (val);
  }

  return (0xffffffff - val + 1) * -1;
}
19114
public static long readUnsignedIntegerLittleEndian(InputStream io) throws IOException {
		long value = io.read();
		if (value < 0) throw new EOFException();
		int i = io.read();
		if (i < 0) throw new EOFException();
		value |= i << 8;
		i = io.read();
		if (i < 0) throw new EOFException();
		value |= i << 16;
		i = io.read();
		if (i < 0) throw new EOFException();
		value |= ((long)i) << 24;
		return value;
	}
281299
private int readShort(InputStream in, CRC32 crc) throws IOException {
        int b = readByte(in, crc);
        return ((readByte(in, crc) << 8) & 0x00ff00) | b;
    }
685272
@Override
	public int readBit() {
		if (position == size) throw new EndOfBitStreamException();
		int count = (int) position & 7;
		if (count == 0) { // need new bits
			buffer = readByte();
			if (buffer == -1) throw new EndOfBitStreamException();
		}
		position++;
		// other endian
		// return (buffer >> count) & 1;
		return (buffer >> (7 - count)) & 1;
	}
1369512
def write_uint32(self, value, little_endian=True):
        
        if little_endian:
            endian = "<"
        else:
            endian = ">"
        return self.pack('%sI' % endian, value)
888673
def _detect_endian(cls, stream):
        
        stream.seek(0)
        endian_str = stream.read(2)
        return BIG_ENDIAN if endian_str == b'MM' else LITTLE_ENDIAN
1126464
private long read32(byte[] buffer, int offset) {
        byte b0 = buffer[offset];
        byte b1 = buffer[offset + 1];
        byte b2 = buffer[offset + 2];
        byte b3 = buffer[offset + 3];

        // convert signed bytes to unsigned values
        int i0 = ((b0 & 0x80) == 0x80 ? (b0 & 0x7F) + 0x80 : b0);
        int i1 = ((b1 & 0x80) == 0x80 ? (b1 & 0x7F) + 0x80 : b1);
        int i2 = ((b2 & 0x80) == 0x80 ? (b2 & 0x7F) + 0x80 : b2);
        int i3 = ((b3 & 0x80) == 0x80 ? (b3 & 0x7F) + 0x80 : b3);

        return ((long) i0 << 24) + ((long) i1 << 16) + ((long) i2 << 8) + (long) i3;
    }
906552
def read_large_int(self, bits, signed=True):
        """"""
        return int.from_bytes(
            self.read(bits // 8), byteorder='little', signed=signed)
12257
public static int readRawVarint32(
      final int firstByte, final InputStream input) throws IOException {
    if ((firstByte & 0x80) == 0) {
      return firstByte;
    }

    int result = firstByte & 0x7f;
    int offset = 7;
    for (; offset < 32; offset += 7) {
      final int b = input.read();
      if (b == -1) {
        throw InvalidProtocolBufferException.truncatedMessage();
      }
      result |= (b & 0x7f) << offset;
      if ((b & 0x80) == 0) {
        return result;
      }
    }
    // Keep reading up to 64 bits.
    for (; offset < 64; offset += 7) {
      final int b = input.read();
      if (b == -1) {
        throw InvalidProtocolBufferException.truncatedMessage();
      }
      if ((b & 0x80) == 0) {
        return result;
      }
    }
    throw InvalidProtocolBufferException.malformedVarint();
  }
386268
def read_uint(data, start, length):
    """"""
    return int.from_bytes(data[start:start+length], byteorder='big')