File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
library/src/main/java/com/loopj/android/http Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,8 @@ public void writeTo(final OutputStream out) throws IOException {
190
190
191
191
// End the file's object and prepare for next one.
192
192
os .write ('}' );
193
+ } else if (value instanceof JsonValueInterface ) {
194
+ os .write (((JsonValueInterface ) value ).getEscapedJsonValue ());
193
195
} else if (value instanceof Boolean ) {
194
196
os .write ((Boolean ) value ? JSON_TRUE : JSON_FALSE );
195
197
} else if (value instanceof Long ) {
Original file line number Diff line number Diff line change
1
+ /*
2
+ Android Asynchronous Http Client
3
+ Copyright (c) 2011 James Smith <[email protected] >
4
+ http://loopj.com
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License.
8
+ You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ */
18
+
19
+ package com .loopj .android .http ;
20
+
21
+ /**
22
+ * This interface is used to encapsulate JSON values that are handled entirely
23
+ * by the app. For example, apps could manage any type of JSON on their own (and
24
+ * not rely on {@link org.json.JSONArray} or {@link org.json.JSONObject} to
25
+ * exchange data.
26
+ *
27
+ * @author Noor Dawod <[email protected] >
28
+ */
29
+ public interface JsonValueInterface {
30
+
31
+ /**
32
+ * Returns the escaped, ready-to-be used value of this encapsulated object.
33
+ *
34
+ * @return byte array holding the data to be used (as-is) in a JSON object
35
+ */
36
+ byte [] getEscapedJsonValue ();
37
+ }
You can’t perform that action at this time.
0 commit comments