2022-06-10 21:38:30 +09:00

375 lines
8.8 KiB
Smali

.class final Lcom/google/api/client/http/javanet/NetHttpResponse;
.super Lcom/google/api/client/http/LowLevelHttpResponse;
.source "NetHttpResponse.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/google/api/client/http/javanet/NetHttpResponse$SizeValidatingInputStream;
}
.end annotation
# instance fields
.field private final connection:Ljava/net/HttpURLConnection;
.field private final headerNames:Ljava/util/ArrayList;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/ArrayList<",
"Ljava/lang/String;",
">;"
}
.end annotation
.end field
.field private final headerValues:Ljava/util/ArrayList;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/ArrayList<",
"Ljava/lang/String;",
">;"
}
.end annotation
.end field
.field private final responseCode:I
.field private final responseMessage:Ljava/lang/String;
# direct methods
.method public constructor <init>(Ljava/net/HttpURLConnection;)V
.locals 5
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
invoke-direct {p0}, Lcom/google/api/client/http/LowLevelHttpResponse;-><init>()V
.line 2
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
iput-object v0, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->headerNames:Ljava/util/ArrayList;
.line 3
new-instance v1, Ljava/util/ArrayList;
invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V
iput-object v1, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->headerValues:Ljava/util/ArrayList;
.line 4
iput-object p1, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->connection:Ljava/net/HttpURLConnection;
.line 5
invoke-virtual {p1}, Ljava/net/HttpURLConnection;->getResponseCode()I
move-result v2
const/4 v3, -0x1
if-ne v2, v3, :cond_0
const/4 v2, 0x0
.line 6
:cond_0
iput v2, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->responseCode:I
.line 7
invoke-virtual {p1}, Ljava/net/HttpURLConnection;->getResponseMessage()Ljava/lang/String;
move-result-object v2
iput-object v2, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->responseMessage:Ljava/lang/String;
.line 8
invoke-virtual {p1}, Ljava/net/HttpURLConnection;->getHeaderFields()Ljava/util/Map;
move-result-object p1
invoke-interface {p1}, Ljava/util/Map;->entrySet()Ljava/util/Set;
move-result-object p1
invoke-interface {p1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object p1
:cond_1
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
move-result v2
if-eqz v2, :cond_3
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/util/Map$Entry;
.line 9
invoke-interface {v2}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
move-result-object v3
check-cast v3, Ljava/lang/String;
if-eqz v3, :cond_1
.line 10
invoke-interface {v2}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/util/List;
invoke-interface {v2}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object v2
:cond_2
:goto_0
invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z
move-result v4
if-eqz v4, :cond_1
invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v4
check-cast v4, Ljava/lang/String;
if-eqz v4, :cond_2
.line 11
invoke-interface {v0, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z
.line 12
invoke-interface {v1, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z
goto :goto_0
:cond_3
return-void
.end method
# virtual methods
.method public disconnect()V
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->connection:Ljava/net/HttpURLConnection;
invoke-virtual {v0}, Ljava/net/HttpURLConnection;->disconnect()V
return-void
.end method
.method public getContent()Ljava/io/InputStream;
.locals 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
:try_start_0
iget-object v0, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->connection:Ljava/net/HttpURLConnection;
invoke-virtual {v0}, Ljava/net/HttpURLConnection;->getInputStream()Ljava/io/InputStream;
move-result-object v0
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
.line 2
:catch_0
iget-object v0, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->connection:Ljava/net/HttpURLConnection;
invoke-virtual {v0}, Ljava/net/HttpURLConnection;->getErrorStream()Ljava/io/InputStream;
move-result-object v0
:goto_0
if-nez v0, :cond_0
const/4 v0, 0x0
goto :goto_1
.line 3
:cond_0
new-instance v1, Lcom/google/api/client/http/javanet/NetHttpResponse$SizeValidatingInputStream;
invoke-direct {v1, p0, v0}, Lcom/google/api/client/http/javanet/NetHttpResponse$SizeValidatingInputStream;-><init>(Lcom/google/api/client/http/javanet/NetHttpResponse;Ljava/io/InputStream;)V
move-object v0, v1
:goto_1
return-object v0
.end method
.method public getContentEncoding()Ljava/lang/String;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->connection:Ljava/net/HttpURLConnection;
invoke-virtual {v0}, Ljava/net/HttpURLConnection;->getContentEncoding()Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method public getContentLength()J
.locals 2
.line 1
iget-object v0, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->connection:Ljava/net/HttpURLConnection;
const-string v1, "Content-Length"
invoke-virtual {v0, v1}, Ljava/net/HttpURLConnection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
if-nez v0, :cond_0
const-wide/16 v0, -0x1
goto :goto_0
.line 2
:cond_0
invoke-static {v0}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J
move-result-wide v0
:goto_0
return-wide v0
.end method
.method public getContentType()Ljava/lang/String;
.locals 2
.line 1
iget-object v0, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->connection:Ljava/net/HttpURLConnection;
const-string v1, "Content-Type"
invoke-virtual {v0, v1}, Ljava/net/HttpURLConnection;->getHeaderField(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method public getHeaderCount()I
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->headerNames:Ljava/util/ArrayList;
invoke-virtual {v0}, Ljava/util/ArrayList;->size()I
move-result v0
return v0
.end method
.method public getHeaderName(I)Ljava/lang/String;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->headerNames:Ljava/util/ArrayList;
invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
move-result-object p1
check-cast p1, Ljava/lang/String;
return-object p1
.end method
.method public getHeaderValue(I)Ljava/lang/String;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->headerValues:Ljava/util/ArrayList;
invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
move-result-object p1
check-cast p1, Ljava/lang/String;
return-object p1
.end method
.method public getReasonPhrase()Ljava/lang/String;
.locals 1
.line 1
iget-object v0, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->responseMessage:Ljava/lang/String;
return-object v0
.end method
.method public getStatusCode()I
.locals 1
.line 1
iget v0, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->responseCode:I
return v0
.end method
.method public getStatusLine()Ljava/lang/String;
.locals 2
.line 1
iget-object v0, p0, Lcom/google/api/client/http/javanet/NetHttpResponse;->connection:Ljava/net/HttpURLConnection;
const/4 v1, 0x0
invoke-virtual {v0, v1}, Ljava/net/HttpURLConnection;->getHeaderField(I)Ljava/lang/String;
move-result-object v0
if-eqz v0, :cond_0
const-string v1, "HTTP/1."
.line 2
invoke-virtual {v0, v1}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v1
if-eqz v1, :cond_0
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
return-object v0
.end method