Processes {@link #_file}, breaking apart any lines on which multiple line-number markers appear in different
columns.

@return the list of broken lines
497767
private List<String> breakLines(List<LineNumberPosition> o_LineBrokenPositions) throws IOException
    {
        int numLinesRead = 0;
        int lineOffset = 0;
        List<String> brokenLines = new ArrayList<>();

        try (BufferedReader r = new BufferedReader(new FileReader(_file)))
        {
            for (int posIndex = 0; posIndex < _positions.size(); posIndex++)
            {
                LineNumberPosition pos = _positions.get(posIndex);
                o_LineBrokenPositions.add(new LineNumberPosition(
                            pos.getOriginalLine(), pos.getEmittedLine() + lineOffset, pos.getEmittedColumn()));

                // Copy the input file up to but not including the emitted line # in "pos".
                while (numLinesRead < pos.getEmittedLine() - 1)
                {
                    brokenLines.add(r.readLine());
                    numLinesRead++;
                }

                // Read the line that contains the next line number annotations, but don't write it yet.
                String line = r.readLine();
                numLinesRead++;

                // See if there are two original line annotations on the same emitted line.
                LineNumberPosition nextPos;
                int prevPartLen = 0;
                char[] indent = {};
                do
                {
                    nextPos = (posIndex < _positions.size() - 1) ? _positions.get(posIndex + 1) : null;
                    if (nextPos != null
                                && nextPos.getEmittedLine() == pos.getEmittedLine()
                                && nextPos.getOriginalLine() > pos.getOriginalLine())
                    {
                        // Two different source line numbers on the same emitted line!
                        posIndex++;
                        lineOffset++;
                        String firstPart = line.substring(0, nextPos.getEmittedColumn() - prevPartLen - 1);
                        brokenLines.add(new String(indent) + firstPart);
                        prevPartLen += firstPart.length();
                        indent = new char[prevPartLen];
                        Arrays.fill(indent, ' ');
                        line = line.substring(firstPart.length(), line.length());

                        // Alter the position while adding it.
                        o_LineBrokenPositions.add(new LineNumberPosition(
                                    nextPos.getOriginalLine(), nextPos.getEmittedLine() + lineOffset, nextPos
                                                .getEmittedColumn()));
                    }
                    else
                    {
                        nextPos = null;
                    }
                }
                while (nextPos != null);

                // Nothing special here-- just emit the line.
                brokenLines.add(new String(indent) + line);
            }

            // Copy out the remainder of the file.
            String line;
            while ((line = r.readLine()) != null)
            {
                brokenLines.add(line);
            }
        }
        return brokenLines;
    }
263663
function (file, errors, options) {
      var reports = []
        , content = file.content.split('\n');

      errors.forEach(function error (err) {
        // some linters don't return the location -_-
        if (!err.line) return reports.push(err.message.grey, '');

        var start = err.line > 3 ? err.line - 3 : 0
          , stop = err.line + 2
          , range = content.slice(start, stop)
          , numbers = _.range(start + 1, stop + 1)
          , len = stop.toString().length;

        reports.push('Lint error: ' + err.line + ' col ' + err.column);
        range.map(function reformat (line) {
          var lineno = numbers.shift()
            , offender = lineno === err.line
            , inline = /\'[^\']+?\'/
            , slice;

          // this is the actual line with the error, so we should start finding
          // what the error is and how we could highlight it in the output
          if (offender) {
            if (line.length < err.column) {
              // we are missing something at the end of the line.. so add a red
              // square
              line += ' '.inverse.red;
            } else {
              // we have a direct match on a statement
              if (inline.test(err.message)) {
                slice = err.message.match(inline)[0].replace(/\'/g, '');
              } else {
                // it's happening in the center of things, so we can start
                // coloring inside the shizzle
                slice = line.slice(err.column - 1);
              }

              line = line.replace(slice, slice.inverse.red);
            }
          }

          reports.push('  ' + pad(lineno, len) + ' | ' + line);
        });

        reports.push('');
        reports.push(err.message.grey);
        reports.push('');

      });

      // output the shizzle
      reports.forEach(function output (line) {
        this.logger.error(line);
      }.bind(this));
    }
1246670
public Optional<Iterable<DbFileSources.Line>> getLines(DbSession dbSession, String fileUuid, int from, int toInclusive) {
    return getLines(dbSession, fileUuid, from, toInclusive, Function.identity());
  }
1134482
protected float[] findLimitsTwoLines() {
        boolean repeat = false;
        for (;;) {
            if (repeat && currentLeading == 0)
                return null;
            repeat = true;
            float x1[] = findLimitsOneLine();
            if (lineStatus == LINE_STATUS_OFFLIMITS)
                return null;
            yLine -= currentLeading;
            if (lineStatus == LINE_STATUS_NOLINE) {
                continue;
            }
            float x2[] = findLimitsOneLine();
            if (lineStatus == LINE_STATUS_OFFLIMITS)
                return null;
            if (lineStatus == LINE_STATUS_NOLINE) {
                yLine -= currentLeading;
                continue;
            }
            if (x1[0] >= x2[1] || x2[0] >= x1[1])
                continue;
            return new float[]{x1[0], x1[1], x2[0], x2[1]};
        }
    }
1284681
private String[] readLine() throws IOException {
        // Read the next number of non zeros.
        String line = reader.readLine();
        if (line == null)
            throw new IllegalArgumentException(
                    "The matrix file is improperly formatted");
        return line.split("\\s+");
    }
624923
private int[] getLineLengths() {
		List<Integer> lineLengthsList = new ArrayList<Integer>();
		int linelength = 0;
		for (int i = 0; i < source.length(); i++) {
			linelength++;
			char ch = source.charAt(i);
			if (ch == '\n') {
				lineLengthsList.add(linelength);
				linelength = 0;
			}
		}
		lineLengthsList.add(linelength);
		int[] result = new int[lineLengthsList.size()];
		for (int i = 0; i < lineLengthsList.size(); i++) {
			result[i] = lineLengthsList.get(i);
		}
		return result;

	}
11128
public static List<String> readFileToLinesList( File file ) throws IOException {
        List<String> lines = new ArrayList<>();
        try (BufferedReader br = new BufferedReader(new FileReader(file))) {
            String line;
            while( (line = br.readLine()) != null ) {
                lines.add(line);
            }
            return lines;
        }
    }
1367628
public static List<String> readCommentedTextFile(final String file) throws IOException {
        BufferedReader reader = getBufferedReaderForUtf8(file);
        try {
            final List<String> lines = new ArrayList<String>();
            for (String line = reader.readLine(); line != null; line = reader.readLine()) {
                final String trimmed = line.trim();
                if (trimmed.length() == 0) {
                    continue;
                }
                final int hashIndex = trimmed.indexOf('#');
                if (hashIndex == -1) {
                    lines.add(trimmed);
                } else {
                    final String realPart = trimmed.substring(0, hashIndex).trim();
                    if (realPart.length() > 0) {
                        lines.add(realPart);
                    }
                }
            }
            return lines;
        } finally {
            try {
                reader.close();
            } catch (final IOException e) {
                // intentionally empty
            }
        }
    }
228297
public static List<String> linesFrom(InputStream is) {
        ArrayList<String> lines = new ArrayList<String>();
        for (String line : new LineReader(is)) {
            if (line.length() > 0 && !line.startsWith("#"))
                lines.add(line);
        }
        return lines;
    }
662812
def process_line(line, line_number, filename)
      warnings = all_warnings_for_line(line, line_number, filename)
      fix_input(warnings, line, line_number, filename) if @settings[:fix]
      warnings
    end
751589
private List<ValidationPlanResult> validateFile(File file, Writer writer) throws IOException
	{

		List<ValidationPlanResult> messages = new ArrayList<ValidationPlanResult>();
		ArrayList<Object> entryList = new ArrayList<Object>();
		BufferedReader fileReader = null; 

		try
		{
			fileReader= new BufferedReader(new FileReader(file));
			prepareReader(	fileReader,file.getName());
			List<ValidationPlanResult> results = validateEntriesInReader(writer,file,entryList);
			ValidationPlanResult entrySetResult = validateEntry(entryList);
			if (file != null)
			{
				entrySetResult.setTargetOrigin(file.getName());
			}
			for (ValidationPlanResult planResult : results)
			{
				messages.add(planResult);
			}
			if (!entrySetResult.isValid())
			{
				writeResultsToFile(entrySetResult);
				messages.add(entrySetResult);
			}

		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		finally{
			if(fileReader!=null)
			fileReader.close();
		}

		return messages;
	}
543908
public static ArrayList<Line> getLinesInTextFile(String encoding, File file) throws IOException {
		ArrayList<Line> lines = new ArrayList<Line>();
		FileInputStream inputStream = new FileInputStream(file);
		InputStreamReader inputReader = null;
		if(encoding != null) {
			inputReader = new InputStreamReader(inputStream, encoding);
		} else {
			inputReader = new InputStreamReader(inputStream);
		}
		//FileReader fileReader = new FileReader(file);
		BufferedReader reader = new BufferedReader(inputReader);
		String line; int count = 0;
		while ((line = reader.readLine()) != null) {
			count++;
			lines.add(new Line(file.getName(), count, line));
		}
		reader.close();
		return lines;
	}
507549
public void reformatFile() throws IOException
    {
        List<LineNumberPosition> lineBrokenPositions = new ArrayList<>();
        List<String> brokenLines = breakLines(lineBrokenPositions);
        emitFormatted(brokenLines, lineBrokenPositions);
    }
669877
public static String tail2( File file, int lines) {
        lines++;    // Read # lines inclusive
        java.io.RandomAccessFile fileHandler = null;
        try {
            fileHandler =
                    new java.io.RandomAccessFile( file, "r" );
            long fileLength = fileHandler.length() - 1;
            StringBuilder sb = new StringBuilder();
            int line = 0;

            for(long filePointer = fileLength; filePointer != -1; filePointer--){
                fileHandler.seek( filePointer );
                int readByte = fileHandler.readByte();

                if( readByte == 0xA ) {
                    line = line + 1;
                    if (line == lines) {
                        if (filePointer == fileLength - 1) {
                            continue;
                        } else {
                            break;
                        }
                    }
                }
                sb.append( ( char ) readByte );
            }

            String lastLine = sb.reverse().toString();
            return lastLine;
        } catch( java.io.FileNotFoundException e ) {
            e.printStackTrace();
            return null;
        } catch( java.io.IOException e ) {
            e.printStackTrace();
            return null;
        }
        finally {
            if (fileHandler != null )
                try {
                    fileHandler.close();
                } catch (IOException e) {
                /* ignore */
                }
        }
    }
406595
public static List<Specification> parseSpecification(File file) {
        List<Specification> monitorables = new ArrayList<>();
        try {
            InputStream stream = new FileInputStream(file);
            monitorables = parseInputSpecification(stream);
        } catch (Exception e) {
            logger.error(String.format("Ignoring file %s", file.getName()));
        }
        return monitorables;
    }
607487
public function getLinesFromFile() : array
    {
        $filename = $this->filename;

        if (!file_exists($filename)) {
            throw new \InvalidArgumentException("File not found: {$filename}");
        }

        return (array) file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    }
404488
private void processFiles() {
        String[] fileArgs = getOptionValues(INFILE_SHORT_OPT);
        final List<File> files = new ArrayList<File>(fileArgs.length);
        for (final String fileArg : fileArgs) {
            File file = new File(fileArg);
            if (!file.canRead()) {
                error(INPUT_FILE_UNREADABLE + file);
            } else {
                files.add(file);
            }
        }

        if (files.size() == 0) {
            error(NO_DOCUMENT_FILES);
            failUsage();
        }

        // Create the directory artifact or fail
        artifactPath = createDirectoryArtifact(outputDirectory, DIR_ARTIFACT);
        processFiles(files.toArray(new File[0]));
    }