ResponseBody.smali
12.8 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
.class public abstract Lcom/brplug/okhttp3/ResponseBody;
.super Ljava/lang/Object;
.source "ResponseBody.java"
# interfaces
.implements Ljava/io/Closeable;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/brplug/okhttp3/ResponseBody$BomAwareReader;
}
.end annotation
# instance fields
.field private reader:Ljava/io/Reader;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end field
# direct methods
.method private static synthetic $closeResource(Ljava/lang/Throwable;Ljava/lang/AutoCloseable;)V
.locals 0
if-eqz p0, :cond_0
.line 137
:try_start_0
invoke-interface {p1}, Ljava/lang/AutoCloseable;->close()V
:try_end_0
.catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception p1
invoke-virtual {p0, p1}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V
goto :goto_0
:cond_0
invoke-interface {p1}, Ljava/lang/AutoCloseable;->close()V
:goto_0
return-void
.end method
.method public constructor <init>()V
.locals 0
.line 103
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method private charset()Ljava/nio/charset/Charset;
.locals 2
.line 187
invoke-virtual {p0}, Lcom/brplug/okhttp3/ResponseBody;->contentType()Lcom/brplug/okhttp3/MediaType;
move-result-object v0
if-eqz v0, :cond_0
.line 188
sget-object v1, Ljava/nio/charset/StandardCharsets;->UTF_8:Ljava/nio/charset/Charset;
invoke-virtual {v0, v1}, Lcom/brplug/okhttp3/MediaType;->charset(Ljava/nio/charset/Charset;)Ljava/nio/charset/Charset;
move-result-object v0
goto :goto_0
:cond_0
sget-object v0, Ljava/nio/charset/StandardCharsets;->UTF_8:Ljava/nio/charset/Charset;
:goto_0
return-object v0
.end method
.method public static create(Lcom/brplug/okhttp3/MediaType;JLcom/brplug/okio/BufferedSource;)Lcom/brplug/okhttp3/ResponseBody;
.locals 1
.param p0 # Lcom/brplug/okhttp3/MediaType;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
if-eqz p3, :cond_0
.line 228
new-instance v0, Lcom/brplug/okhttp3/ResponseBody$1;
invoke-direct {v0, p0, p1, p2, p3}, Lcom/brplug/okhttp3/ResponseBody$1;-><init>(Lcom/brplug/okhttp3/MediaType;JLcom/brplug/okio/BufferedSource;)V
return-object v0
.line 227
:cond_0
new-instance p0, Ljava/lang/NullPointerException;
const-string p1, "source == null"
invoke-direct {p0, p1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
throw p0
.end method
.method public static create(Lcom/brplug/okhttp3/MediaType;Lcom/brplug/okio/ByteString;)Lcom/brplug/okhttp3/ResponseBody;
.locals 3
.param p0 # Lcom/brplug/okhttp3/MediaType;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.line 220
new-instance v0, Lcom/brplug/okio/Buffer;
invoke-direct {v0}, Lcom/brplug/okio/Buffer;-><init>()V
invoke-virtual {v0, p1}, Lcom/brplug/okio/Buffer;->write(Lcom/brplug/okio/ByteString;)Lcom/brplug/okio/Buffer;
move-result-object v0
.line 221
invoke-virtual {p1}, Lcom/brplug/okio/ByteString;->size()I
move-result p1
int-to-long v1, p1
invoke-static {p0, v1, v2, v0}, Lcom/brplug/okhttp3/ResponseBody;->create(Lcom/brplug/okhttp3/MediaType;JLcom/brplug/okio/BufferedSource;)Lcom/brplug/okhttp3/ResponseBody;
move-result-object p0
return-object p0
.end method
.method public static create(Lcom/brplug/okhttp3/MediaType;Ljava/lang/String;)Lcom/brplug/okhttp3/ResponseBody;
.locals 2
.param p0 # Lcom/brplug/okhttp3/MediaType;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.line 200
sget-object v0, Ljava/nio/charset/StandardCharsets;->UTF_8:Ljava/nio/charset/Charset;
if-eqz p0, :cond_0
.line 202
invoke-virtual {p0}, Lcom/brplug/okhttp3/MediaType;->charset()Ljava/nio/charset/Charset;
move-result-object v0
if-nez v0, :cond_0
.line 204
sget-object v0, Ljava/nio/charset/StandardCharsets;->UTF_8:Ljava/nio/charset/Charset;
.line 205
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
const-string p0, "; charset=utf-8"
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
invoke-static {p0}, Lcom/brplug/okhttp3/MediaType;->parse(Ljava/lang/String;)Lcom/brplug/okhttp3/MediaType;
move-result-object p0
.line 208
:cond_0
new-instance v1, Lcom/brplug/okio/Buffer;
invoke-direct {v1}, Lcom/brplug/okio/Buffer;-><init>()V
invoke-virtual {v1, p1, v0}, Lcom/brplug/okio/Buffer;->writeString(Ljava/lang/String;Ljava/nio/charset/Charset;)Lcom/brplug/okio/Buffer;
move-result-object p1
.line 209
invoke-virtual {p1}, Lcom/brplug/okio/Buffer;->size()J
move-result-wide v0
invoke-static {p0, v0, v1, p1}, Lcom/brplug/okhttp3/ResponseBody;->create(Lcom/brplug/okhttp3/MediaType;JLcom/brplug/okio/BufferedSource;)Lcom/brplug/okhttp3/ResponseBody;
move-result-object p0
return-object p0
.end method
.method public static create(Lcom/brplug/okhttp3/MediaType;[B)Lcom/brplug/okhttp3/ResponseBody;
.locals 3
.param p0 # Lcom/brplug/okhttp3/MediaType;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.line 214
new-instance v0, Lcom/brplug/okio/Buffer;
invoke-direct {v0}, Lcom/brplug/okio/Buffer;-><init>()V
invoke-virtual {v0, p1}, Lcom/brplug/okio/Buffer;->write([B)Lcom/brplug/okio/Buffer;
move-result-object v0
.line 215
array-length p1, p1
int-to-long v1, p1
invoke-static {p0, v1, v2, v0}, Lcom/brplug/okhttp3/ResponseBody;->create(Lcom/brplug/okhttp3/MediaType;JLcom/brplug/okio/BufferedSource;)Lcom/brplug/okhttp3/ResponseBody;
move-result-object p0
return-object p0
.end method
# virtual methods
.method public final byteStream()Ljava/io/InputStream;
.locals 1
.line 116
invoke-virtual {p0}, Lcom/brplug/okhttp3/ResponseBody;->source()Lcom/brplug/okio/BufferedSource;
move-result-object v0
invoke-interface {v0}, Lcom/brplug/okio/BufferedSource;->inputStream()Ljava/io/InputStream;
move-result-object v0
return-object v0
.end method
.method public final bytes()[B
.locals 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 129
invoke-virtual {p0}, Lcom/brplug/okhttp3/ResponseBody;->contentLength()J
move-result-wide v0
const-wide/32 v2, 0x7fffffff
cmp-long v2, v0, v2
if-gtz v2, :cond_4
.line 135
invoke-virtual {p0}, Lcom/brplug/okhttp3/ResponseBody;->source()Lcom/brplug/okio/BufferedSource;
move-result-object v2
const/4 v3, 0x0
.line 136
:try_start_0
invoke-interface {v2}, Lcom/brplug/okio/BufferedSource;->readByteArray()[B
move-result-object v4
:try_end_0
.catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-eqz v2, :cond_0
.line 137
invoke-static {v3, v2}, Lcom/brplug/okhttp3/ResponseBody;->$closeResource(Ljava/lang/Throwable;Ljava/lang/AutoCloseable;)V
:cond_0
const-wide/16 v2, -0x1
cmp-long v2, v0, v2
if-eqz v2, :cond_2
.line 138
array-length v2, v4
int-to-long v2, v2
cmp-long v2, v0, v2
if-nez v2, :cond_1
goto :goto_0
.line 139
:cond_1
new-instance v2, Ljava/io/IOException;
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v5, "Content-Length ("
invoke-virtual {v3, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3, v0, v1}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
const-string v0, ") and stream length ("
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
array-length v0, v4
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
const-string v0, ") disagree"
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-direct {v2, v0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw v2
:cond_2
:goto_0
return-object v4
:catchall_0
move-exception v0
goto :goto_1
:catch_0
move-exception v3
.line 135
:try_start_1
throw v3
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
:goto_1
if-eqz v2, :cond_3
.line 137
invoke-static {v3, v2}, Lcom/brplug/okhttp3/ResponseBody;->$closeResource(Ljava/lang/Throwable;Ljava/lang/AutoCloseable;)V
:cond_3
throw v0
.line 131
:cond_4
new-instance v2, Ljava/io/IOException;
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "Cannot buffer entire body for content length: "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3, v0, v1}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-direct {v2, v0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw v2
.end method
.method public final charStream()Ljava/io/Reader;
.locals 3
.line 160
iget-object v0, p0, Lcom/brplug/okhttp3/ResponseBody;->reader:Ljava/io/Reader;
if-eqz v0, :cond_0
goto :goto_0
.line 161
:cond_0
new-instance v0, Lcom/brplug/okhttp3/ResponseBody$BomAwareReader;
invoke-virtual {p0}, Lcom/brplug/okhttp3/ResponseBody;->source()Lcom/brplug/okio/BufferedSource;
move-result-object v1
invoke-direct {p0}, Lcom/brplug/okhttp3/ResponseBody;->charset()Ljava/nio/charset/Charset;
move-result-object v2
invoke-direct {v0, v1, v2}, Lcom/brplug/okhttp3/ResponseBody$BomAwareReader;-><init>(Lcom/brplug/okio/BufferedSource;Ljava/nio/charset/Charset;)V
iput-object v0, p0, Lcom/brplug/okhttp3/ResponseBody;->reader:Ljava/io/Reader;
:goto_0
return-object v0
.end method
.method public close()V
.locals 1
.line 192
invoke-virtual {p0}, Lcom/brplug/okhttp3/ResponseBody;->source()Lcom/brplug/okio/BufferedSource;
move-result-object v0
invoke-static {v0}, Lcom/brplug/okhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V
return-void
.end method
.method public abstract contentLength()J
.end method
.method public abstract contentType()Lcom/brplug/okhttp3/MediaType;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end method
.method public abstract source()Lcom/brplug/okio/BufferedSource;
.end method
.method public final string()Ljava/lang/String;
.locals 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 180
invoke-virtual {p0}, Lcom/brplug/okhttp3/ResponseBody;->source()Lcom/brplug/okio/BufferedSource;
move-result-object v0
const/4 v1, 0x0
.line 181
:try_start_0
invoke-direct {p0}, Lcom/brplug/okhttp3/ResponseBody;->charset()Ljava/nio/charset/Charset;
move-result-object v2
invoke-static {v0, v2}, Lcom/brplug/okhttp3/internal/Util;->bomAwareCharset(Lcom/brplug/okio/BufferedSource;Ljava/nio/charset/Charset;)Ljava/nio/charset/Charset;
move-result-object v2
.line 182
invoke-interface {v0, v2}, Lcom/brplug/okio/BufferedSource;->readString(Ljava/nio/charset/Charset;)Ljava/lang/String;
move-result-object v2
:try_end_0
.catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-eqz v0, :cond_0
.line 183
invoke-static {v1, v0}, Lcom/brplug/okhttp3/ResponseBody;->$closeResource(Ljava/lang/Throwable;Ljava/lang/AutoCloseable;)V
:cond_0
return-object v2
:catchall_0
move-exception v2
goto :goto_0
:catch_0
move-exception v1
.line 180
:try_start_1
throw v1
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
:goto_0
if-eqz v0, :cond_1
.line 183
invoke-static {v1, v0}, Lcom/brplug/okhttp3/ResponseBody;->$closeResource(Ljava/lang/Throwable;Ljava/lang/AutoCloseable;)V
:cond_1
throw v2
.end method