summaryrefslogtreecommitdiffstats
path: root/core/java/android/util/JsonScope.java
diff options
context:
space:
mode:
authorJesse Wilson <jessewilson@google.com>2010-08-03 17:55:09 -0700
committerJesse Wilson <jessewilson@google.com>2010-08-06 10:34:44 -0700
commit76d7e20a75d24afb2f5011a7646dbde8aaa52087 (patch)
treee2c154665a99c94c94fb8f5bf44d400befb190fa /core/java/android/util/JsonScope.java
parentfdde0003e662f0a7c3f13efb49169e3e9e568cce (diff)
downloadframeworks_base-76d7e20a75d24afb2f5011a7646dbde8aaa52087.zip
frameworks_base-76d7e20a75d24afb2f5011a7646dbde8aaa52087.tar.gz
frameworks_base-76d7e20a75d24afb2f5011a7646dbde8aaa52087.tar.bz2
A new streaming JSON API.
Change-Id: Iefa7ee44ddacbe22ea9ebca3165ac59030659bf2
Diffstat (limited to 'core/java/android/util/JsonScope.java')
-rw-r--r--core/java/android/util/JsonScope.java68
1 files changed, 68 insertions, 0 deletions
diff --git a/core/java/android/util/JsonScope.java b/core/java/android/util/JsonScope.java
new file mode 100644
index 0000000..ca534e9
--- /dev/null
+++ b/core/java/android/util/JsonScope.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.util;
+
+/**
+ * Lexical scoping elements within a JSON reader or writer.
+ */
+enum JsonScope {
+
+ /**
+ * An array with no elements requires no separators or newlines before
+ * it is closed.
+ */
+ EMPTY_ARRAY,
+
+ /**
+ * A array with at least one value requires a comma and newline before
+ * the next element.
+ */
+ NONEMPTY_ARRAY,
+
+ /**
+ * An object with no name/value pairs requires no separators or newlines
+ * before it is closed.
+ */
+ EMPTY_OBJECT,
+
+ /**
+ * An object whose most recent element is a key. The next element must
+ * be a value.
+ */
+ DANGLING_NAME,
+
+ /**
+ * An object with at least one name/value pair requires a comma and
+ * newline before the next element.
+ */
+ NONEMPTY_OBJECT,
+
+ /**
+ * No object or array has been started.
+ */
+ EMPTY_DOCUMENT,
+
+ /**
+ * A document with at an array or object.
+ */
+ NONEMPTY_DOCUMENT,
+
+ /**
+ * A document that's been closed and cannot be accessed.
+ */
+ CLOSED,
+}