124 lines
2.3 KiB
Smali
124 lines
2.3 KiB
Smali
|
.class Lcom/bugsnag/android/IOUtils;
|
||
|
.super Ljava/lang/Object;
|
||
|
.source "IOUtils.java"
|
||
|
|
||
|
|
||
|
# static fields
|
||
|
.field private static final DEFAULT_BUFFER_SIZE:I = 0x1000
|
||
|
|
||
|
.field private static final EOF:I = -0x1
|
||
|
|
||
|
|
||
|
# direct methods
|
||
|
.method constructor <init>()V
|
||
|
.locals 0
|
||
|
|
||
|
.prologue
|
||
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public static close(Ljava/net/URLConnection;)V
|
||
|
.locals 1
|
||
|
.param p0, "conn" # Ljava/net/URLConnection;
|
||
|
.annotation build Landroid/support/annotation/Nullable;
|
||
|
.end annotation
|
||
|
.end param
|
||
|
|
||
|
.prologue
|
||
|
instance-of v0, p0, Ljava/net/HttpURLConnection;
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
check-cast p0, Ljava/net/HttpURLConnection;
|
||
|
|
||
|
.end local p0 # "conn":Ljava/net/URLConnection;
|
||
|
invoke-virtual {p0}, Ljava/net/HttpURLConnection;->disconnect()V
|
||
|
|
||
|
:cond_0
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public static closeQuietly(Ljava/io/Closeable;)V
|
||
|
.locals 1
|
||
|
.param p0, "closeable" # Ljava/io/Closeable;
|
||
|
.annotation build Landroid/support/annotation/Nullable;
|
||
|
.end annotation
|
||
|
.end param
|
||
|
|
||
|
.prologue
|
||
|
if-eqz p0, :cond_0
|
||
|
|
||
|
:try_start_0
|
||
|
invoke-interface {p0}, Ljava/io/Closeable;->close()V
|
||
|
:try_end_0
|
||
|
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
|
||
|
|
||
|
:cond_0
|
||
|
:goto_0
|
||
|
return-void
|
||
|
|
||
|
:catch_0
|
||
|
move-exception v0
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method public static copy(Ljava/io/Reader;Ljava/io/Writer;)I
|
||
|
.locals 8
|
||
|
.param p0, "input" # Ljava/io/Reader;
|
||
|
.param p1, "output" # Ljava/io/Writer;
|
||
|
.annotation system Ldalvik/annotation/Throws;
|
||
|
value = {
|
||
|
Ljava/io/IOException;
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
.prologue
|
||
|
const/4 v4, -0x1
|
||
|
|
||
|
const/16 v5, 0x1000
|
||
|
|
||
|
new-array v0, v5, [C
|
||
|
|
||
|
.local v0, "buffer":[C
|
||
|
const-wide/16 v2, 0x0
|
||
|
|
||
|
.local v2, "count":J
|
||
|
const/4 v1, 0x0
|
||
|
|
||
|
.local v1, "n":I
|
||
|
:goto_0
|
||
|
invoke-virtual {p0, v0}, Ljava/io/Reader;->read([C)I
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
if-eq v4, v1, :cond_0
|
||
|
|
||
|
const/4 v5, 0x0
|
||
|
|
||
|
invoke-virtual {p1, v0, v5, v1}, Ljava/io/Writer;->write([CII)V
|
||
|
|
||
|
int-to-long v6, v1
|
||
|
|
||
|
add-long/2addr v2, v6
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:cond_0
|
||
|
const-wide/32 v6, 0x7fffffff
|
||
|
|
||
|
cmp-long v5, v2, v6
|
||
|
|
||
|
if-lez v5, :cond_1
|
||
|
|
||
|
:goto_1
|
||
|
return v4
|
||
|
|
||
|
:cond_1
|
||
|
long-to-int v4, v2
|
||
|
|
||
|
goto :goto_1
|
||
|
.end method
|