MCPcopy Index your code
hub / github.com/apache/tomcat / matches

Method matches

java/org/apache/jasper/compiler/JspReader.java:287–322  ·  view source on GitHub ↗

search the stream for a match to a string @param string The string to match @return true is one is found, the current position in stream is positioned after the search string, false otherwise, position in stream unchanged.

(String string)

Source from the content-addressed store, hash-verified

285 * string, <strong> false</strong> otherwise, position in stream unchanged.
286 */
287 boolean matches(String string) {
288 int len = string.length();
289 int cursor = current.cursor;
290 int streamSize = current.stream.length;
291 if (cursor + len < streamSize) { // Try to scan in memory
292 int line = current.line;
293 int col = current.col;
294 int ch;
295 int i = 0;
296 for (; i < len; i++) {
297 ch = current.stream[i + cursor];
298 if (string.charAt(i) != ch) {
299 return false;
300 }
301 if (ch == '\n') {
302 line++;
303 col = 0;
304 } else {
305 col++;
306 }
307 }
308 current.update(i + cursor, line, col);
309 } else {
310 Mark mark = mark();
311 int ch;
312 int i = 0;
313 do {
314 ch = nextChar();
315 if (((char) ch) != string.charAt(i++)) {
316 setCurrent(mark);
317 return false;
318 }
319 } while (i < len);
320 }
321 return true;
322 }
323
324 boolean matchesETag(String tagName) {
325 Mark mark = mark();

Callers 3

matchesETagMethod · 0.95

Calls 6

markMethod · 0.95
nextCharMethod · 0.95
setCurrentMethod · 0.95
lengthMethod · 0.80
charAtMethod · 0.80
updateMethod · 0.65

Tested by

no test coverage detected