You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
copy JsonReader.java and JsonWriter.java from AOSP
This commit is contained in:
1173
src/api-impl/android/util/JsonReader.java
Normal file
1173
src/api-impl/android/util/JsonReader.java
Normal file
File diff suppressed because it is too large
Load Diff
68
src/api-impl/android/util/JsonScope.java
Normal file
68
src/api-impl/android/util/JsonScope.java
Normal file
@@ -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,
|
||||||
|
}
|
||||||
82
src/api-impl/android/util/JsonToken.java
Normal file
82
src/api-impl/android/util/JsonToken.java
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A structure, name or value type in a JSON-encoded string.
|
||||||
|
*/
|
||||||
|
public enum JsonToken {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The opening of a JSON array. Written using {@link JsonWriter#beginObject}
|
||||||
|
* and read using {@link JsonReader#beginObject}.
|
||||||
|
*/
|
||||||
|
BEGIN_ARRAY,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The closing of a JSON array. Written using {@link JsonWriter#endArray}
|
||||||
|
* and read using {@link JsonReader#endArray}.
|
||||||
|
*/
|
||||||
|
END_ARRAY,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The opening of a JSON object. Written using {@link JsonWriter#beginObject}
|
||||||
|
* and read using {@link JsonReader#beginObject}.
|
||||||
|
*/
|
||||||
|
BEGIN_OBJECT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The closing of a JSON object. Written using {@link JsonWriter#endObject}
|
||||||
|
* and read using {@link JsonReader#endObject}.
|
||||||
|
*/
|
||||||
|
END_OBJECT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A JSON property name. Within objects, tokens alternate between names and
|
||||||
|
* their values. Written using {@link JsonWriter#name} and read using {@link
|
||||||
|
* JsonReader#nextName}
|
||||||
|
*/
|
||||||
|
NAME,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A JSON string.
|
||||||
|
*/
|
||||||
|
STRING,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A JSON number represented in this API by a Java {@code double}, {@code
|
||||||
|
* long}, or {@code int}.
|
||||||
|
*/
|
||||||
|
NUMBER,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A JSON {@code true} or {@code false}.
|
||||||
|
*/
|
||||||
|
BOOLEAN,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A JSON {@code null}.
|
||||||
|
*/
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The end of the JSON stream. This sentinel value is returned by {@link
|
||||||
|
* JsonReader#peek()} to signal that the JSON-encoded value has no more
|
||||||
|
* tokens.
|
||||||
|
*/
|
||||||
|
END_DOCUMENT
|
||||||
|
}
|
||||||
528
src/api-impl/android/util/JsonWriter.java
Normal file
528
src/api-impl/android/util/JsonWriter.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -370,6 +370,10 @@ hax_jar = jar('hax', [
|
|||||||
'android/util/DecompiledXmlResourceParser.java',
|
'android/util/DecompiledXmlResourceParser.java',
|
||||||
'android/util/DisplayMetrics.java',
|
'android/util/DisplayMetrics.java',
|
||||||
'android/util/FloatMath.java',
|
'android/util/FloatMath.java',
|
||||||
|
'android/util/JsonReader.java',
|
||||||
|
'android/util/JsonScope.java',
|
||||||
|
'android/util/JsonToken.java',
|
||||||
|
'android/util/JsonWriter.java',
|
||||||
'android/util/LayoutDirection.java',
|
'android/util/LayoutDirection.java',
|
||||||
'android/util/Log.java',
|
'android/util/Log.java',
|
||||||
'android/util/LongSparseArray.java',
|
'android/util/LongSparseArray.java',
|
||||||
|
|||||||
Reference in New Issue
Block a user