Read all remaining data in the packet.

        (Subsequent read() will return errors.)
182634
def read_all(self):
        
        result = self._data[self._position:]
        self._position = None  # ensure no subsequent read()
        return result
226793
async def _read_data(self):
        """"""
        last_error = ConnectionClosedError(
            "Connection has been closed by server")
        while not self._reader.at_eof():
            try:
                obj = await self._reader.readobj()
            except asyncio.CancelledError:
                # NOTE: reader can get cancelled from `close()` method only.
                last_error = RuntimeError('this is unexpected')
                break
            except ProtocolError as exc:
                # ProtocolError is fatal
                # so connection must be closed
                if self._in_transaction is not None:
                    self._transaction_error = exc
                last_error = exc
                break
            except Exception as exc:
                # NOTE: for QUIT command connection error can be received
                #       before response
                last_error = exc
                break
            else:
                if (obj == b'' or obj is None) and self._reader.at_eof():
                    logger.debug("Connection has been closed by server,"
                                 " response: %r", obj)
                    last_error = ConnectionClosedError("Reader at end of file")
                    break

                if isinstance(obj, MaxClientsError):
                    last_error = obj
                    break
                if self._in_pubsub:
                    self._process_pubsub(obj)
                else:
                    self._process_data(obj)
        self._closing = True
        self._loop.call_soon(self._do_close, last_error)
129539
private void readData()
        throws IOException
    {
        while (!isClosed) {
            int code = is.read();

            switch (code) {
                case ' ':
                case '\t':
                case '\n':
                case '\r':
                    break;

                case 'C': {
                    int channel = (is.read() << 8) + is.read();

                    inputReady[channel] = true;
                    return;
                }

                case 'E': {
                    int channel = (is.read() << 8) + is.read();
                    int status = (is.read() << 8) + is.read();

                    inputReady[channel] = true;

                    return;
                }

                case -1:
                    close();
                    return;

                default:
                    // An error in the protocol.  Kill the connection.
                    close();
                    return;
            }
        }

        return;
    }
1347862
def read(self, data, offset=0):
        
        if isinstance(data, Buffer):
            return data.read(self)

        try:
            args = list(self._struct.unpack_from(data, offset))
        except TypeError as error:
            # Working around struct.unpack_from issue #10212
            logger.debug("error: %s", error)
            args = list(self._struct.unpack_from(str(bytearray(data)), offset))
        args.reverse()
        return self.popValue(args)
223230
private int readPacket(byte[] packet, int offset, int psize) throws IOException {
        int length = 0;
        if(position+psize<source.length)
    	{
    		length=psize;
    		System.arraycopy(source, position, packet, offset, length);
    		position+=psize;
    	}
    	else if(position<source.length)
    	{
    		length=source.length-position;
    		System.arraycopy(source, position, packet, offset, length);
    		position+=length;
    	}
        
        return length;
    }
571955
def _read_loop(self, data=''):
        
        while True:
            if not self.is_connected or self.is_connecting or self.io.closed():
                break

            try:
                yield self.io.read_bytes(
                    DEFAULT_READ_CHUNK_SIZE,
                    streaming_callback=self._ps.parse,
                    partial=True)
            except tornado.iostream.StreamClosedError as e:
                self._err = e
                if self._error_cb is not None and not self.is_reconnecting and not self.is_closed:
                    self._error_cb(e)
                break
241413
def read(self):
        """"""
        try:
            return self.reader.recv(1)
        except socket.error:
            ex = exception().exception
            if ex.args[0] == errno.EWOULDBLOCK:
                raise IOError
            raise
1193386
def read_bytes(self):
		
		global exit_flag

		for self.i in range(0, self.length) :
			self.bytes[self.i] = i_max[self.i]
			self.maxbytes[self.i] = total_chunks[self.i]
			self.progress[self.i]["maximum"] = total_chunks[self.i]
			self.progress[self.i]["value"] = self.bytes[self.i]
			self.str[self.i].set(file_name[self.i]+ "       " + str(self.bytes[self.i]) 
								  + "KB / " + str(int(self.maxbytes[self.i] + 1)) + " KB")

		if exit_flag == self.length:
			exit_flag = 0
			self.frame.destroy()
		else:
			self.frame.after(10, self.read_bytes)
841739
def readall(self):
        # type: () -> bytes
        '''
        
        '''
        if not self._open:
            raise pycdlibexception.PyCdlibInvalidInput('I/O operation on closed file.')

        readsize = self._length - self._offset
        if readsize > 0:
            data = self._fp.read(readsize)
            self._offset += readsize
        else:
            data = b''

        return data
374020
def CollectData(self):
        
        while 1:  # loop until we get data or a timeout
            _bytes = self._ReadPacket()
            if not _bytes:
                return None
            if len(_bytes) < 4 + 8 + 1 or _bytes[0] < 0x20 or _bytes[0] > 0x2F:
                logging.warning("Wanted data, dropped type=0x%02x, len=%d",
                                _bytes[0], len(_bytes))
                continue

            seq, _type, x, y = struct.unpack("BBBB", _bytes[:4])
            data = [
                struct.unpack(">hhhh", _bytes[x:x + 8])
                for x in range(4,
                               len(_bytes) - 8, 8)
            ]

            if self._last_seq and seq & 0xF != (self._last_seq + 1) & 0xF:
                logging.warning("Data sequence skipped, lost packet?")
            self._last_seq = seq

            if _type == 0:
                if not self._coarse_scale or not self._fine_scale:
                    logging.warning(
                        "Waiting for calibration, dropped data packet.")
                    continue
                out = []
                for main, usb, aux, voltage in data:
                    if main & 1:
                        coarse = ((main & ~1) - self._coarse_zero)
                        out.append(coarse * self._coarse_scale)
                    else:
                        out.append((main - self._fine_zero) * self._fine_scale)
                return out
            elif _type == 1:
                self._fine_zero = data[0][0]
                self._coarse_zero = data[1][0]
            elif _type == 2:
                self._fine_ref = data[0][0]
                self._coarse_ref = data[1][0]
            else:
                logging.warning("Discarding data packet type=0x%02x", _type)
                continue

            # See http://wiki/Main/MonsoonProtocol for details on these values.
            if self._coarse_ref != self._coarse_zero:
                self._coarse_scale = 2.88 / (
                    self._coarse_ref - self._coarse_zero)
            if self._fine_ref != self._fine_zero:
                self._fine_scale = 0.0332 / (self._fine_ref - self._fine_zero)
537144
def read_packets(self):
        """"""
        while self.running:
            packet_length = self.client.recv(2)
            if len(packet_length) < 2:
                self.stop()
                continue
            packet_length = struct.unpack("<h", packet_length)[0] - 2

            data = self.client.recv(packet_length)
            packno = data[0]

            try:
                parser = "Packet" + format(packno, 'x').upper() + "Parser"
                packet_class = getattr(packets, parser)
                packet_class().parse(self.world, self.player, data, self._evman)
            except AttributeError as e:
                pass

            if packno == 2:
                self.stop()
                continue
324734
def parsedata(self, packet):
        ''''''
        data = []
        datalength = ord(packet[3])
        position = 4
        while position < datalength + 4:
            data.append(packet[position])
            position += 1
        return data
67549
protected boolean readPacket ()
        throws IOException
    {
        int result;
        while ((result = _stream.packetout(_packet)) != 1) {
            if (result == 0 && !readPage()) {
                return false;
            }
        }
        return true;
    }
860286
def read(self, length=None):
        """"""
        if length is None:
            return self.reader.read()

        result = self.reader.read(length)
        if len(result) != length:
            raise BufferError(
                'No more data left to read (need {}, got {}: {}); last read {}'
                .format(length, len(result), repr(result), repr(self._last))
            )

        self._last = result
        return result
811517
def read_bytes(self, count):
        """"""
        if self.pos + count > self.remaining_length:
            return NC.ERR_PROTOCOL, None
        
        ba = bytearray(count)
        for x in xrange(0, count):
            ba[x] = self.payload[self.pos]
            self.pos += 1
        
        return NC.ERR_SUCCESS, ba
101821
def read(self, size=None):
        
        if size is None or size < 0:
            return "".join(list(self))
        else:
            data_chunks = []
            data_readed = 0
            try:
                while data_readed < size:
                    chunk = self.next_chunk()
                    data_chunks.append(chunk)
                    data_readed += len(chunk)
            except StopIteration:
                pass

            if data_readed > size:
                last_chunk = data_chunks.pop()
                extra_length = data_readed - size
                last_chunk, extra_data = last_chunk[:-extra_length], last_chunk[-extra_length:]
                self.unshift(extra_data)
                data_chunks.append(last_chunk)
            return "".join(data_chunks)
344886
def _sense_packet_to_data(packet):
        """"""
        data = bytearray(0)
        last = 0
        i = 1
        while (i < len(packet)):
            if not (last == 2 and packet[i] == 0):
                data.append(packet[i])
            last = packet[i]
            i += 1

        return data