MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / readSimpleString

Method readSimpleString

java/src/org/openqa/selenium/json/Input.java:126–144  ·  view source on GitHub ↗

Attempt to consume the body of a JSON string (with the leading quote already consumed) directly from the buffered input, including its closing quote. This is the fast path for strings that contain no escape sequences and whose closing quote is already buffered: the result is created straight fro

()

Source from the content-addressed store, hash-verified

124 * @return the string body; {@code null} if the caller must fall back to reading char by char
125 */
126 public @Nullable String readSimpleString() {
127 if (!fill()) {
128 return null;
129 }
130
131 int start = position + 1;
132 for (int i = start; i < filled; i++) {
133 char c = buffer[i];
134 if (c == '"') {
135 position = i;
136 return new String(buffer, start, i - start);
137 }
138 if (c == '\\' || c < 0x20) {
139 return null;
140 }
141 }
142
143 return null;
144 }
145
146 /**
147 * Consume characters that need no special handling within a JSON string, appending them to the

Callers 1

readStringMethod · 0.80

Calls 1

fillMethod · 0.95

Tested by

no test coverage detected