Here you can find the source of readLinesTrimmedNoCommmentFromBufferedReader(final BufferedReader in, final String commentString)
private static String[] readLinesTrimmedNoCommmentFromBufferedReader(final BufferedReader in, final String commentString) throws IOException
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.IOException; import java.util.ArrayList; public class Main { private static String[] readLinesTrimmedNoCommmentFromBufferedReader(final BufferedReader in, final String commentString) throws IOException { ArrayList<String> lineList = new ArrayList<String>(); String line;/*w w w . j a v a 2 s . co m*/ while (in.ready()) { line = in.readLine(); if (line == null) { continue; } line = line.trim(); if (line.startsWith(commentString)) continue; if (line.contains(commentString)) { String[] items = line.split(commentString); line = items[0].trim(); } lineList.add(line); } in.close(); String[] lines = new String[lineList.size()]; lineList.toArray(lines); return lines; } }