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

Method peek

java/src/org/openqa/selenium/json/JsonInput.java:145–210  ·  view source on GitHub ↗

Peek at the next input string character to determine the pending JSON element type. @return JsonType indicating the pending JSON element type @throws JsonException if unable to determine the type of the pending element @throws UncheckedIOException if an I/O exception is encountered

()

Source from the content-addressed store, hash-verified

143 * @throws UncheckedIOException if an I/O exception is encountered
144 */
145 public JsonType peek() {
146 // A single token is typically peeked at several times on its way through the coercers, so
147 // the computed type is memoized until the token is consumed.
148 JsonType type = peekedType;
149 if (type != null) {
150 return type;
151 }
152
153 skipWhitespace(input);
154
155 switch (input.peek()) {
156 case 'f':
157 case 't':
158 type = JsonType.BOOLEAN;
159 break;
160
161 case 'n':
162 type = JsonType.NULL;
163 break;
164
165 case '-':
166 case '0':
167 case '1':
168 case '2':
169 case '3':
170 case '4':
171 case '5':
172 case '6':
173 case '7':
174 case '8':
175 case '9':
176 type = JsonType.NUMBER;
177 break;
178
179 case '"':
180 type = isReadingName() ? JsonType.NAME : JsonType.STRING;
181 break;
182
183 case '{':
184 type = JsonType.START_MAP;
185 break;
186
187 case '}':
188 type = JsonType.END_MAP;
189 break;
190
191 case '[':
192 type = JsonType.START_COLLECTION;
193 break;
194
195 case ']':
196 type = JsonType.END_COLLECTION;
197 break;
198
199 case Input.EOF:
200 type = JsonType.END;
201 break;
202

Callers 6

hasNextMethod · 0.95
skipValueMethod · 0.95
expectMethod · 0.95
nextBooleanMethod · 0.45
readNumberLexemeMethod · 0.45
readMethod · 0.45

Calls 3

skipWhitespaceMethod · 0.95
isReadingNameMethod · 0.95
readMethod · 0.65

Tested by

no test coverage detected