< prev index next >

src/java.base/share/classes/java/util/Properties.java

Print this page
rev 16769 : 8176041: Optimize handling of comment lines in Properties$LineReader.readLine
Reviewed-by: TBD

*** 492,503 **** appendedLineBegin = false; } if (isNewLine) { isNewLine = false; if (c == '#' || c == '!') { isCommentLine = true; - continue; } } if (c != '\n' && c != '\r') { lineBuf[len++] = c; --- 492,516 ---- appendedLineBegin = false; } if (isNewLine) { isNewLine = false; if (c == '#' || c == '!') { + // Comment, quickly consume the rest of the line, + // resume on line-break and backslash. + while (inOff < inLimit) { + if (inStream != null) { + //The line below is equivalent to calling a + //ISO8859-1 decoder. + c = (char) (0xff & inByteBuf[inOff++]); + } else { + c = inCharBuf[inOff++]; + } + if (c == '\n' || c == '\r' || c == '\\') { + break; + } + } isCommentLine = true; } } if (c != '\n' && c != '\r') { lineBuf[len++] = c;
< prev index next >