Scans the parameters list for the "lines" parameter and uses
it to set the number of lines to be returned in the filtered stream.
768998
private function initialize()
    {
        $params = $this->getParameters();
        if ($params !== null) {
            for ($i = 0, $_i = count($params); $i < $_i; $i++) {
                if (self::LINES_KEY == $params[$i]->getName()) {
                    $this->lines = (int) $params[$i]->getValue();
                    continue;
                }
                if (self::SKIP_KEY == $params[$i]->getName()) {
                    $this->skip = (int) $params[$i]->getValue();
                    continue;
                }
            }
        }
    }
957907
def ReadLines(self, file_object):
    
    lines_size = len(self.lines)
    if lines_size < self._buffer_size:
      lines_size = self._buffer_size - lines_size
      while lines_size > 0:
        line = self._ReadLine(file_object)
        if not line:
          break

        self.lines = ''.join([self.lines, line])
        lines_size -= len(line)
1176346
def stream_lines(tokens, line_num)
      yield line_start(line_num)

      tokens.each do |token, value|
        yield @inner.span(token, value)
      end

      yield line_end(line_num)
    end
834975
def _lines(self):
        

        chunkIndices = self._listChunks()
        for chunkIndex in chunkIndices:
            with self._openChunk(chunkIndex) as chunk:
                yield from chunk._lines()
616766
public ScanParams count(final Integer count) {
    params.put(COUNT, ByteBuffer.wrap(Protocol.toByteArray(count)));
    return this;
  }
465527
@Override
    public List<MonitorLine> getLinesFrom(Object actual) throws Exception {
        //TODO Enhance line retrieve to get last lines directly
        String line;
        Integer currentLineNo = 0;
        final List<MonitorLine> result = new ArrayList<MonitorLine>();
        BufferedReader in = null;
        try {
            in = new BufferedReader(new FileReader(getFilename()));

            Integer startLine = (actual == null) ? 0 : (Integer) actual;
            //read to startLine
            while (currentLineNo < startLine + 1) {
                if (in.readLine() == null) {
                    throw new IOException("File too small");
                }
                currentLineNo++;
            }
            //read until endLine
            line = in.readLine();
            while (line != null) {
                result.add(new MonitorLine(currentLineNo, line));
                currentLineNo++;
                line = in.readLine();
            }
        } finally {
            try {
                if (in != null) {
                    in.close();
                }
            } catch (IOException ignore) {
            }
        }
        return result;
    }
380364
public static int countLines(InputStream is) throws IOException {
        try {
            byte[] c = new byte[1024];
            int count = 0;
            int readChars = 0;
            boolean empty = true;
            while ((readChars = is.read(c)) != -1) {
                empty = false;
                for (int i = 0; i < readChars; ++i) {
                    if (c[i] == '\n') {
                        ++count;
                    }
                }
            }
            return (count == 0 && !empty) ? 1 : count;
        } finally {
            is.close();
        }


    }
105377
private List<String> processLine(String line,
			BufferedReader buf,
			int fieldLength)
					throws IOException{

		//System.out.println("XX processLine " + fieldLength + " " + line);
		// go through the line and process each character
		List<String> lineData = new ArrayList<String>();

		boolean inString = false;

		StringBuilder bigWord = null;

		while ( true ){

			if ( line.startsWith(STRING_LIMIT)){
				if (! inString){

					inString = true;
					if ( line.length() > 1)
						bigWord = new StringBuilder(line.substring(1));
					else
						bigWord = new StringBuilder("");


				} else {
					// the end of a word
					lineData.add(bigWord.toString());
					bigWord = null;
					inString = false;

				}
			} else {
				if ( inString )
					bigWord.append(line);
				else {

					List<String> dat = processSingleLine(line);

					for (String d : dat){
						lineData.add(d);
					}
				}
			}

			//System.out.println("in process line : " + lineData.size() + " " + fieldLength);

			if ( lineData.size() > fieldLength){

				logger.warn("wrong data length ("+lineData.size()+
						") should be ("+fieldLength+") at line " + line + " got lineData: " + lineData);
				return lineData;
			}

			if ( lineData.size() == fieldLength)
				return lineData;


			line = buf.readLine();
			if ( line == null)
				break;
		}
		return lineData;

	}
1094351
def _process_plan_lines(self, final_line_count):
        """"""
        if not self._lines_seen["plan"]:
            self._add_error(_("Missing a plan."))
            return

        if len(self._lines_seen["plan"]) > 1:
            self._add_error(_("Only one plan line is permitted per file."))
            return

        plan, at_line = self._lines_seen["plan"][0]
        if not self._plan_on_valid_line(at_line, final_line_count):
            self._add_error(
                _("A plan must appear at the beginning or end of the file.")
            )
            return

        if plan.expected_tests != self._lines_seen["test"]:
            self._add_error(
                _("Expected {expected_count} tests but only {seen_count} ran.").format(
                    expected_count=plan.expected_tests,
                    seen_count=self._lines_seen["test"],
                )
            )
1232844
public FilterStreamParameters follow(long follow) {
		if (this.follow.length() > 0) {
			this.follow.append(',');
		}
		this.follow.append(follow);
		return this;
	}
1153253
def _process_streams(cls, streams):
        
        parameterizeds = defaultdict(set)
        valid, invalid = [], []
        for s in streams:
            if isinstance(s, Stream):
                pass
            elif isinstance(s, param.Parameter):
                s = Params(s.owner, [s.name])
            elif isinstance(s, param.Parameterized):
                s = Params(s)
            elif util.is_param_method(s):
                if not hasattr(s, "_dinfo"):
                    continue
                s = ParamMethod(s)
            else:
                invalid.append(s)
                continue
            if isinstance(s, Params):
                pid = id(s.parameterized)
                overlap = (set(s.parameters) & parameterizeds[pid])
                if overlap:
                    pname = type(s.parameterized).__name__
                    param.main.param.warning(
                        'The %s parameter(s) on the %s object have '
                        'already been supplied in another stream. '
                        'Ensure that the supplied streams only specify '
                        'each parameter once, otherwise multiple '
                        'events will be triggered when the parameter '
                        'changes.' % (sorted(overlap), pname))
                parameterizeds[pid] |= set(s.parameters)
            valid.append(s)
        return valid, invalid
1047429
def readlines(self, size=None):
        
        last_pos = self._pos
        result = []
        if size is not None:
            end = min(self.limit, last_pos + size)
        else:
            end = self.limit
        while 1:
            if size is not None:
                size -= last_pos - self._pos
            if self._pos >= end:
                break
            result.append(self.readline(size))
            if size is not None:
                last_pos = self._pos
        return result
1104775
public static ArrayList<String> getFilteredLinesFromFile(final String fileName,
                                                           final String filter,
                                                           final String removeBeforeToken,
                                                           final String removeAfterToken) throws IOException{
    final ArrayList<String> filteredLines = new ArrayList<>();
    try (final BufferedReader in = new BufferedReader(
            new InputStreamReader(new FileInputStream(fileName), StandardCharsets.UTF_8))) {
      String line = "";
      while ((line = in.readLine()) != null) {
        if (line.trim().length() == 0) {
          continue;
        }
        if (line.contains(filter)) {
          String trimedLine;
          if (removeBeforeToken != null) {
            final String[] p = line.split(removeBeforeToken);
            if (p.length > 1) {
              trimedLine = p[p.length-1];
            } else {
              trimedLine = line.trim();
            }
          } else {
            trimedLine = line.trim();
          }
          if (removeAfterToken != null) {
            final String[] p = trimedLine.split(removeAfterToken);
            if (p.length > 1) {
              trimedLine = p[0];
            }
          }
          filteredLines.add(trimedLine);
        }
      }
    }
    return filteredLines;
  }
955868
def forward_lines(size = 10)

      file   = @file
      result = ""

      while result.scan(/\r\n|\r|\n/).size < size && !file.eof?

        result += file.gets
      end

      result
    end
870960
def load_lines(self, key, noexpire=None):
        ''''''
        return line_iterator(self.load_fd(key, noexpire=noexpire))
1154230
def list_line(self, line):
        
        
        if len(line) == 0:
            return
        
        self.stream.write(str(line[0]))
        
        for item in line[1:]:
            self.stream.write("\t")
            self.stream.write(str(item))
        
        self.stream.write("\n")
1195821
public void readData(BufferedReader in) throws IOException {
    final String SEEN = "SEEN";
    String line;
    int lineNum = 1;
    // all lines have one tagging with raw count per line
    line = in.readLine();
    Pattern p = Pattern.compile("^smooth\\[([0-9])\\] = (.*)$");
    while (line != null && line.length() > 0) {
      try {
        Matcher m = p.matcher(line);
        if (m.matches()) {
          int i = Integer.parseInt(m.group(1));
          smooth[i] = Double.parseDouble(m.group(2));
        } else {
          // split on spaces, quote with doublequote, and escape with backslash
          String[] fields = StringUtils.splitOnCharWithQuoting(line, ' ', '\"', '\\');
          // System.out.println("fields:\n" + fields[0] + "\n" + fields[1] +
          // "\n" + fields[2] + "\n" + fields[3] + "\n" + fields[4]);
          boolean seen = fields[3].equals(SEEN);
          addTagging(seen, new IntTaggedWord(fields[2], fields[0], wordIndex, tagIndex), Double.parseDouble(fields[4]));
        }
      } catch (RuntimeException e) {
        throw new IOException("Error on line " + lineNum + ": " + line, e);
      }
      lineNum++;
      line = in.readLine();
    }
    initRulesWithWord();
  }