Return the next line in the file, updating the offset.
550989
def next(self):
        
        try:
            line = self._get_next_line()
        except StopIteration:
            # we've reached the end of the file; if we're processing the
            # rotated log file or the file has been renamed, we can continue with the actual file; otherwise
            # update the offset file
            if self._is_new_file():
                self._rotated_logfile = None
                self._fh.close()
                self._offset = 0
                # open up current logfile and continue
                try:
                    line = self._get_next_line()
                except StopIteration:  # oops, empty file
                    self._update_offset_file()
                    raise
            else:
                self._update_offset_file()
                raise

        if self.paranoid:
            self._update_offset_file()
        elif self.every_n and self.every_n <= self._since_update:
            self._update_offset_file()

        return line
1105897
def seek(self, offset, whence=0):
        """"""
        self._check_open_file()
        if not self._append:
            self._io.seek(offset, whence)
        else:
            self._read_seek = offset
            self._read_whence = whence
        if not self.is_stream:
            self.flush()
268039
def next(self):
        """"""
        if self._current_index < len(self._collection):
            value = self._collection[self._current_index]
            self._current_index += 1
            return value
        elif self._next_cursor:
            self.__fetch_next()
            return self.next()
        else:
            self._current_index = 0
            raise StopIteration
195146
def readlines(self, offset=0):
        """"""
        try:
            with open(self._filepath) as fp:
                # For full read go through existing lines in file
                if self._full_read:
                    fp.seek(offset)
                    for row in fp:
                        yield row

                # Okay now dynamically tail the file
                if self._tail:
                    while True:
                        current = fp.tell()
                        row = fp.readline()
                        if row:
                            yield row
                        else:
                            fp.seek(current)
                            time.sleep(self._sleep)

        except IOError as err:
            print('Error reading the file {0}: {1}'.format(self._filepath, err))
            return
467715
def next(self):
        
        while True:
            if not self._resp:
                self._start()
            if self._stop:
                raise StopIteration
            skip, data = self._process_data(next_(self._lines))
            if not skip:
                break
        return data
1266531
def next(self):
    "  "

    char = self.char
    if char == '\n':
      self.lineno += 1
      self.colno = 0
    else:
      self.colno += 1
    self.index += 1
    return self.char
1353992
def getline(self):
        """"""
        if self.index >= len(self.lines):
            line = ''
        else:
            line = self.lines[self.index]
            self.index += 1
        return line
131870
def _find_curr_line(self, prev=False):
        
        curr_pos = self.filehandle.tell()

        # jump back 15k characters (at most) and find last newline char
        jump_back = min(self.filehandle.tell(), 15000)
        self.filehandle.seek(-jump_back, 1)
        buff = self.filehandle.read(jump_back)
        self.filehandle.seek(curr_pos, 0)

        if prev and self.prev_pos is not None and self.prev_pos == curr_pos:
            # Number of characters to show before/after the log offset
            error_context = 300
            self.filehandle.seek(-error_context, 1)
            buff = self.filehandle.read(curr_pos)
            hr = "-" * 60
            print("Fatal log parsing loop detected trying to find previous "
                  "log line near offset %s in %s:\n\n%s\n%s\n"
                  "<--- (current log parsing offset) \n%s\n%s\n"
                  % (curr_pos, self.name, hr, buff[:error_context],
                     buff[error_context:error_context + 1], hr),
                  file=sys.stderr)
            raise SystemExit("Cannot parse %s with requested options"
                             % self.filehandle.name)
        else:
            self.prev_pos = curr_pos
        buff = buff.decode("utf-8", "replace")
        newline_pos = buff.rfind('\n')
        if prev:
            newline_pos = buff[:newline_pos].rfind('\n')

        # move back to last newline char
        if newline_pos == -1:
            self.filehandle.seek(0)
            return self.next()

        self.filehandle.seek(newline_pos - jump_back + 1, 1)

        # roll forward until we found a line with a datetime
        try:
            logevent = self.next()
            while not logevent.datetime:
                logevent = self.next()

            return logevent
        except StopIteration:
            # reached end of file
            return None
450882
def next_line(self):
        """"""
        self.line = next(self.lines)  # Will raise StopIteration when there are no more lines
        self.values = self.line.split()
450519
def next(self):
    """"""
    self._has_iterated = True

    if self._read_before_start:
      self._blob_reader.readline()
      self._read_before_start = False
    start_position = self._blob_reader.tell()

    if start_position > self._end_position:
      raise StopIteration()

    line = self._blob_reader.readline()

    if not line:
      raise StopIteration()

    return start_position, line.rstrip("\n")
1356005
def read_next_into_buf(self):
        
        file_pos = self.fileobject.tell()
        if (file_pos == 0) and (self.buf == b''):
            raise StopIteration
        while file_pos and (self.get_start_of_line() == 0):
            bytes_to_read = min(self.bufsize, file_pos)
            file_pos = file_pos - bytes_to_read
            self.fileobject.seek(file_pos)
            new_stuff = self.fileobject.read(bytes_to_read)[:bytes_to_read]
            self.fileobject.seek(file_pos)
            self.buf = new_stuff + self.buf
1122691
public byte[] readLine(int offset) throws IOException {
		int lastIndex = -1;
		int localOffset = offset;
		int read;
		do {
			read = ensureBuffer(localOffset, BUFFER_SIZE);
			if (read <= 0) {
				// EOF
				this.pos = this.buffer.length;
				return null;
			}

			// NOT EOF, search for end of line
			final int end = localOffset + read;
			for (int idx = localOffset; (lastIndex == -1) && (idx < this.buffer.length) && (idx < end); ++idx) {
				if ((this.buffer[idx] == '\n') || (this.buffer[idx] == '\r')) {
					lastIndex = idx;
				}
			}
			localOffset += read;
		}
		while (lastIndex == -1);
		this.pos = lastIndex;
		return Arrays.copyOfRange(this.buffer, offset, lastIndex);
	}
227955
def _get_at_pos(self, pos):
        """"""

        if pos < 0:
            # line 0 is the start of the file, no more above
            return None, None

        if len(self.lines) > pos:
            # we have that line so return it
            return self.lines[pos], pos

        if self.file is None:
            # file is closed, so there are no more lines
            return None, None

        assert pos == len(self.lines), "out of order request?"

        self.read_next_line()

        return self.lines[-1], pos
489358
def move_next(lines=1, file=sys.stdout):
    
    move.next(lines).write(file=file)
457137
def _get_line(self) -> str:
        """"""
        line = self.in_lines[self.index]
        self.index += 1
        return line
8178
def stream_fastq(file_handler):
    ''' 
    '''
    next_element = ''
    for i, line in enumerate(file_handler):
        next_element += line
        if i % 4 == 3:
            yield next_element
            next_element = ''
590855
def seek(self, offset):
        
        if self._shifts:
            if 0 <= offset < len(self._shifts):
                current_pos = self._file.tell()
                new_pos = self._shifts[offset]
                if current_pos != new_pos:
                    if current_pos == self._shifts[-1]:  # reached the end of the file
                        self._data = self.__reader()
                        self.__file = iter(self._file.readline, '')
                    self._file.seek(new_pos)
            else:
                raise IndexError('invalid offset')
        else:
            raise self._implement_error