Rahul Ravikumar | 0533600 | 2019-10-14 15:04:32 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.util; |
| 18 | |
| 19 | /** |
| 20 | * A structure, name or value type in a JSON-encoded string. |
| 21 | */ |
| 22 | public enum JsonToken { |
| 23 | |
| 24 | /** |
| 25 | * The opening of a JSON array. Written using {@link JsonWriter#beginObject} |
| 26 | * and read using {@link JsonReader#beginObject}. |
| 27 | */ |
| 28 | BEGIN_ARRAY, |
| 29 | |
| 30 | /** |
| 31 | * The closing of a JSON array. Written using {@link JsonWriter#endArray} |
| 32 | * and read using {@link JsonReader#endArray}. |
| 33 | */ |
| 34 | END_ARRAY, |
| 35 | |
| 36 | /** |
| 37 | * The opening of a JSON object. Written using {@link JsonWriter#beginObject} |
| 38 | * and read using {@link JsonReader#beginObject}. |
| 39 | */ |
| 40 | BEGIN_OBJECT, |
| 41 | |
| 42 | /** |
| 43 | * The closing of a JSON object. Written using {@link JsonWriter#endObject} |
| 44 | * and read using {@link JsonReader#endObject}. |
| 45 | */ |
| 46 | END_OBJECT, |
| 47 | |
| 48 | /** |
| 49 | * A JSON property name. Within objects, tokens alternate between names and |
| 50 | * their values. Written using {@link JsonWriter#name} and read using {@link |
| 51 | * JsonReader#nextName} |
| 52 | */ |
| 53 | NAME, |
| 54 | |
| 55 | /** |
| 56 | * A JSON string. |
| 57 | */ |
| 58 | STRING, |
| 59 | |
| 60 | /** |
| 61 | * A JSON number represented in this API by a Java {@code double}, {@code |
| 62 | * long}, or {@code int}. |
| 63 | */ |
| 64 | NUMBER, |
| 65 | |
| 66 | /** |
| 67 | * A JSON {@code true} or {@code false}. |
| 68 | */ |
| 69 | BOOLEAN, |
| 70 | |
| 71 | /** |
| 72 | * A JSON {@code null}. |
| 73 | */ |
| 74 | NULL, |
| 75 | |
| 76 | /** |
| 77 | * The end of the JSON stream. This sentinel value is returned by {@link |
| 78 | * JsonReader#peek()} to signal that the JSON-encoded value has no more |
| 79 | * tokens. |
| 80 | */ |
| 81 | END_DOCUMENT |
| 82 | } |