Streams.java
2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package com.google.gson.internal;
import com.google.gson.JsonElement;
import com.google.gson.JsonIOException;
import com.google.gson.JsonNull;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSyntaxException;
import com.google.gson.TypeAdapter;
import com.google.gson.internal.bind.TypeAdapters;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.google.gson.stream.MalformedJsonException;
import java.io.EOFException;
import java.io.IOException;
import java.io.Writer;
public final class Streams
{
public static JsonElement parse(JsonReader paramJsonReader)
throws JsonParseException
{
int i = 1;
try
{
paramJsonReader.peek();
i = 0;
paramJsonReader = (JsonElement)TypeAdapters.JSON_ELEMENT.read(paramJsonReader);
return paramJsonReader;
}
catch (EOFException paramJsonReader)
{
if (i != 0) {
return JsonNull.INSTANCE;
}
throw new JsonSyntaxException(paramJsonReader);
}
catch (MalformedJsonException paramJsonReader)
{
throw new JsonSyntaxException(paramJsonReader);
}
catch (IOException paramJsonReader)
{
throw new JsonIOException(paramJsonReader);
}
catch (NumberFormatException paramJsonReader)
{
throw new JsonSyntaxException(paramJsonReader);
}
}
public static void write(JsonElement paramJsonElement, JsonWriter paramJsonWriter)
throws IOException
{
TypeAdapters.JSON_ELEMENT.write(paramJsonWriter, paramJsonElement);
}
public static Writer writerForAppendable(Appendable paramAppendable)
{
if ((paramAppendable instanceof Writer)) {
return (Writer)paramAppendable;
}
return new a(paramAppendable, (byte)0);
}
static final class a
extends Writer
{
private final Appendable a;
private final a b = new a();
private a(Appendable paramAppendable)
{
this.a = paramAppendable;
}
public final void close() {}
public final void flush() {}
public final void write(int paramInt)
throws IOException
{
this.a.append((char)paramInt);
}
public final void write(char[] paramArrayOfChar, int paramInt1, int paramInt2)
throws IOException
{
this.b.a = paramArrayOfChar;
this.a.append(this.b, paramInt1, paramInt1 + paramInt2);
}
static final class a
implements CharSequence
{
char[] a;
public final char charAt(int paramInt)
{
return this.a[paramInt];
}
public final int length()
{
return this.a.length;
}
public final CharSequence subSequence(int paramInt1, int paramInt2)
{
return new String(this.a, paramInt1, paramInt2 - paramInt1);
}
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/google/gson/internal/Streams.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/