MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / peek

Method peek

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

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