/** * This will parse the provided file and returns the parsed key and value content * * @param propertiesStream the Reader of property information * @return a list of {@link PropertiesEntry}s * @throws IOException if something cant be read */ public List<PropertiesEntry> parse(InputStream propertiesStream) throws IOException { List<PropertiesEntry> entryList = new ArrayList<PropertiesEntry>(); LineNumberInputStream in = new LineNumberInputStream(propertiesStream); try { StringBuilder currentComment = new StringBuilder(); String line = readLine(in); while (line != null) { // does it start with a comment marker if (isCommentOrWhiteSpaceLine(line)) { currentComment.append(line).append('\n'); line = readLine(in); } else { // we have changed state. Its a property value. line = readEntryPrimed(in, currentComment, entryList, line, in.getLineNumber()); } } } finally { in.close(); } return entryList; }