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

Method peek

java/src/org/openqa/selenium/json/JsonInput.java:128–174  ·  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

126 * @throws UncheckedIOException if an I/O exception is encountered
127 */
128 public JsonType peek() {
129 skipWhitespace(input);
130
131 switch (input.peek()) {
132 case 'f':
133 case 't':
134 return JsonType.BOOLEAN;
135
136 case 'n':
137 return JsonType.NULL;
138
139 case '-':
140 case '0':
141 case '1':
142 case '2':
143 case '3':
144 case '4':
145 case '5':
146 case '6':
147 case '7':
148 case '8':
149 case '9':
150 return JsonType.NUMBER;
151
152 case '"':
153 return isReadingName() ? JsonType.NAME : JsonType.STRING;
154
155 case '{':
156 return JsonType.START_MAP;
157
158 case '}':
159 return JsonType.END_MAP;
160
161 case '[':
162 return JsonType.START_COLLECTION;
163
164 case ']':
165 return JsonType.END_COLLECTION;
166
167 case Input.EOF:
168 return JsonType.END;
169
170 default:
171 int c = input.read();
172 throw new JsonException("Unable to determine type from: " + (char) c + ". " + input);
173 }
174 }
175
176 /**
177 * Read the next element of the JSON input stream as a boolean value.

Callers 7

hasNextMethod · 0.95
skipValueMethod · 0.95
expectMethod · 0.95
nextBooleanMethod · 0.45
nextNumberMethod · 0.45
readMethod · 0.45
skipWhitespaceMethod · 0.45

Calls 3

skipWhitespaceMethod · 0.95
isReadingNameMethod · 0.95
readMethod · 0.65

Tested by

no test coverage detected