HttpResponse.smali

.class public final Lcom/google/api/client/http/HttpResponse;
.super Ljava/lang/Object;


# instance fields
.field private a:Ljava/io/InputStream;

.field private final b:Ljava/lang/String;

.field private final c:Ljava/lang/String;

.field private final d:Lcom/google/api/client/http/HttpMediaType;

.field e:Lcom/google/api/client/http/LowLevelHttpResponse;

.field private final f:I

.field private final g:Ljava/lang/String;

.field private final h:Lcom/google/api/client/http/HttpRequest;

.field private final i:Z

.field private j:I

.field private k:Z

.field private l:Z


# direct methods
.method constructor <init>(Lcom/google/api/client/http/HttpRequest;Lcom/google/api/client/http/LowLevelHttpResponse;)V
    .registers 9
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object p1, p0, Lcom/google/api/client/http/HttpResponse;->h:Lcom/google/api/client/http/HttpRequest;

    invoke-virtual {p1}, Lcom/google/api/client/http/HttpRequest;->l()Z

    move-result v0

    iput-boolean v0, p0, Lcom/google/api/client/http/HttpResponse;->i:Z

    invoke-virtual {p1}, Lcom/google/api/client/http/HttpRequest;->d()I

    move-result v0

    iput v0, p0, Lcom/google/api/client/http/HttpResponse;->j:I

    invoke-virtual {p1}, Lcom/google/api/client/http/HttpRequest;->r()Z

    move-result v0

    iput-boolean v0, p0, Lcom/google/api/client/http/HttpResponse;->k:Z

    iput-object p2, p0, Lcom/google/api/client/http/HttpResponse;->e:Lcom/google/api/client/http/LowLevelHttpResponse;

    invoke-virtual {p2}, Lcom/google/api/client/http/LowLevelHttpResponse;->c()Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/google/api/client/http/HttpResponse;->b:Ljava/lang/String;

    invoke-virtual {p2}, Lcom/google/api/client/http/LowLevelHttpResponse;->j()I

    move-result v0

    const/4 v1, 0x0

    if-gez v0, :cond_27

    const/4 v0, 0x0

    :cond_27
    iput v0, p0, Lcom/google/api/client/http/HttpResponse;->f:I

    invoke-virtual {p2}, Lcom/google/api/client/http/LowLevelHttpResponse;->i()Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/google/api/client/http/HttpResponse;->g:Ljava/lang/String;

    sget-object v2, Lcom/google/api/client/http/HttpTransport;->a:Ljava/util/logging/Logger;

    iget-boolean v3, p0, Lcom/google/api/client/http/HttpResponse;->k:Z

    if-eqz v3, :cond_3e

    sget-object v3, Ljava/util/logging/Level;->CONFIG:Ljava/util/logging/Level;

    invoke-virtual {v2, v3}, Ljava/util/logging/Logger;->isLoggable(Ljava/util/logging/Level;)Z

    move-result v3

    if-eqz v3, :cond_3e

    const/4 v1, 0x1

    :cond_3e
    const/4 v3, 0x0

    if-eqz v1, :cond_6f

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "-------------- RESPONSE --------------"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    sget-object v5, Lcom/google/api/client/util/StringUtils;->a:Ljava/lang/String;

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p2}, Lcom/google/api/client/http/LowLevelHttpResponse;->k()Ljava/lang/String;

    move-result-object v5

    if-eqz v5, :cond_5a

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    goto :goto_69

    :cond_5a
    iget v5, p0, Lcom/google/api/client/http/HttpResponse;->f:I

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    if-eqz v0, :cond_69

    const/16 v5, 0x20

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    :cond_69
    :goto_69
    sget-object v0, Lcom/google/api/client/util/StringUtils;->a:Ljava/lang/String;

    invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    goto :goto_70

    :cond_6f
    move-object v4, v3

    :goto_70
    invoke-virtual {p1}, Lcom/google/api/client/http/HttpRequest;->j()Lcom/google/api/client/http/HttpHeaders;

    move-result-object v0

    if-eqz v1, :cond_78

    move-object v5, v4

    goto :goto_79

    :cond_78
    move-object v5, v3

    :goto_79
    invoke-virtual {v0, p2, v5}, Lcom/google/api/client/http/HttpHeaders;->j(Lcom/google/api/client/http/LowLevelHttpResponse;Ljava/lang/StringBuilder;)V

    invoke-virtual {p2}, Lcom/google/api/client/http/LowLevelHttpResponse;->e()Ljava/lang/String;

    move-result-object p2

    if-nez p2, :cond_8a

    invoke-virtual {p1}, Lcom/google/api/client/http/HttpRequest;->j()Lcom/google/api/client/http/HttpHeaders;

    move-result-object p1

    invoke-virtual {p1}, Lcom/google/api/client/http/HttpHeaders;->m()Ljava/lang/String;

    move-result-object p2

    :cond_8a
    iput-object p2, p0, Lcom/google/api/client/http/HttpResponse;->c:Ljava/lang/String;

    if-nez p2, :cond_8f

    goto :goto_94

    :cond_8f
    new-instance v3, Lcom/google/api/client/http/HttpMediaType;

    invoke-direct {v3, p2}, Lcom/google/api/client/http/HttpMediaType;-><init>(Ljava/lang/String;)V

    :goto_94
    iput-object v3, p0, Lcom/google/api/client/http/HttpResponse;->d:Lcom/google/api/client/http/HttpMediaType;

    if-eqz v1, :cond_9f

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-virtual {v2, p1}, Ljava/util/logging/Logger;->config(Ljava/lang/String;)V

    :cond_9f
    return-void
.end method

.method private i()Z
    .registers 4
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    invoke-virtual {p0}, Lcom/google/api/client/http/HttpResponse;->g()I

    move-result v0

    invoke-virtual {p0}, Lcom/google/api/client/http/HttpResponse;->f()Lcom/google/api/client/http/HttpRequest;

    move-result-object v1

    invoke-virtual {v1}, Lcom/google/api/client/http/HttpRequest;->i()Ljava/lang/String;

    move-result-object v1

    const-string v2, "HEAD"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_23

    div-int/lit8 v1, v0, 0x64

    const/4 v2, 0x1

    if-eq v1, v2, :cond_23

    const/16 v1, 0xcc

    if-eq v0, v1, :cond_23

    const/16 v1, 0x130

    if-ne v0, v1, :cond_22

    goto :goto_23

    :cond_22
    return v2

    :cond_23
    :goto_23
    invoke-virtual {p0}, Lcom/google/api/client/http/HttpResponse;->j()V

    const/4 v0, 0x0

    return v0
.end method


# virtual methods
.method public a()V
    .registers 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    invoke-virtual {p0}, Lcom/google/api/client/http/HttpResponse;->j()V

    iget-object v0, p0, Lcom/google/api/client/http/HttpResponse;->e:Lcom/google/api/client/http/LowLevelHttpResponse;

    invoke-virtual {v0}, Lcom/google/api/client/http/LowLevelHttpResponse;->a()V

    return-void
.end method

.method public b()Ljava/io/InputStream;
    .registers 6
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    iget-boolean v0, p0, Lcom/google/api/client/http/HttpResponse;->l:Z

    if-nez v0, :cond_48

    iget-object v0, p0, Lcom/google/api/client/http/HttpResponse;->e:Lcom/google/api/client/http/LowLevelHttpResponse;

    invoke-virtual {v0}, Lcom/google/api/client/http/LowLevelHttpResponse;->b()Ljava/io/InputStream;

    move-result-object v0

    if-eqz v0, :cond_45

    :try_start_c
    iget-object v1, p0, Lcom/google/api/client/http/HttpResponse;->b:Ljava/lang/String;

    iget-boolean v2, p0, Lcom/google/api/client/http/HttpResponse;->i:Z

    if-nez v2, :cond_22

    if-eqz v1, :cond_22

    const-string v2, "gzip"

    invoke-virtual {v1, v2}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_22

    new-instance v1, Ljava/util/zip/GZIPInputStream;

    invoke-direct {v1, v0}, Ljava/util/zip/GZIPInputStream;-><init>(Ljava/io/InputStream;)V

    move-object v0, v1

    :cond_22
    sget-object v1, Lcom/google/api/client/http/HttpTransport;->a:Ljava/util/logging/Logger;

    iget-boolean v2, p0, Lcom/google/api/client/http/HttpResponse;->k:Z

    if-eqz v2, :cond_3a

    sget-object v2, Ljava/util/logging/Level;->CONFIG:Ljava/util/logging/Level;

    invoke-virtual {v1, v2}, Ljava/util/logging/Logger;->isLoggable(Ljava/util/logging/Level;)Z

    move-result v2

    if-eqz v2, :cond_3a

    new-instance v2, Lcom/google/api/client/util/LoggingInputStream;

    sget-object v3, Ljava/util/logging/Level;->CONFIG:Ljava/util/logging/Level;

    iget v4, p0, Lcom/google/api/client/http/HttpResponse;->j:I

    invoke-direct {v2, v0, v1, v3, v4}, Lcom/google/api/client/util/LoggingInputStream;-><init>(Ljava/io/InputStream;Ljava/util/logging/Logger;Ljava/util/logging/Level;I)V

    move-object v0, v2

    :cond_3a
    iput-object v0, p0, Lcom/google/api/client/http/HttpResponse;->a:Ljava/io/InputStream;
    :try_end_3c
    .catch Ljava/io/EOFException; {:try_start_c .. :try_end_3c} :catch_42
    .catchall {:try_start_c .. :try_end_3c} :catchall_3d

    goto :goto_45

    :catchall_3d
    move-exception v1

    invoke-virtual {v0}, Ljava/io/InputStream;->close()V

    throw v1

    :catch_42
    invoke-virtual {v0}, Ljava/io/InputStream;->close()V

    :cond_45
    :goto_45
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/google/api/client/http/HttpResponse;->l:Z

    :cond_48
    iget-object v0, p0, Lcom/google/api/client/http/HttpResponse;->a:Ljava/io/InputStream;

    return-object v0
.end method

.method public c()Ljava/nio/charset/Charset;
    .registers 2

    iget-object v0, p0, Lcom/google/api/client/http/HttpResponse;->d:Lcom/google/api/client/http/HttpMediaType;

    if-eqz v0, :cond_12

    invoke-virtual {v0}, Lcom/google/api/client/http/HttpMediaType;->e()Ljava/nio/charset/Charset;

    move-result-object v0

    if-nez v0, :cond_b

    goto :goto_12

    :cond_b
    iget-object v0, p0, Lcom/google/api/client/http/HttpResponse;->d:Lcom/google/api/client/http/HttpMediaType;

    invoke-virtual {v0}, Lcom/google/api/client/http/HttpMediaType;->e()Ljava/nio/charset/Charset;

    move-result-object v0

    goto :goto_14

    :cond_12
    :goto_12
    sget-object v0, Lcom/google/api/client/util/Charsets;->b:Ljava/nio/charset/Charset;

    :goto_14
    return-object v0
.end method

.method public d()Ljava/lang/String;
    .registers 2

    iget-object v0, p0, Lcom/google/api/client/http/HttpResponse;->c:Ljava/lang/String;

    return-object v0
.end method

.method public e()Lcom/google/api/client/http/HttpHeaders;
    .registers 2

    iget-object v0, p0, Lcom/google/api/client/http/HttpResponse;->h:Lcom/google/api/client/http/HttpRequest;

    invoke-virtual {v0}, Lcom/google/api/client/http/HttpRequest;->j()Lcom/google/api/client/http/HttpHeaders;

    move-result-object v0

    return-object v0
.end method

.method public f()Lcom/google/api/client/http/HttpRequest;
    .registers 2

    iget-object v0, p0, Lcom/google/api/client/http/HttpResponse;->h:Lcom/google/api/client/http/HttpRequest;

    return-object v0
.end method

.method public g()I
    .registers 2

    iget v0, p0, Lcom/google/api/client/http/HttpResponse;->f:I

    return v0
.end method

.method public h()Ljava/lang/String;
    .registers 2

    iget-object v0, p0, Lcom/google/api/client/http/HttpResponse;->g:Ljava/lang/String;

    return-object v0
.end method

.method public j()V
    .registers 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    invoke-virtual {p0}, Lcom/google/api/client/http/HttpResponse;->b()Ljava/io/InputStream;

    move-result-object v0

    if-eqz v0, :cond_9

    invoke-virtual {v0}, Ljava/io/InputStream;->close()V

    :cond_9
    return-void
.end method

.method public k()Z
    .registers 2

    iget v0, p0, Lcom/google/api/client/http/HttpResponse;->f:I

    invoke-static {v0}, Lcom/google/api/client/http/HttpStatusCodes;->b(I)Z

    move-result v0

    return v0
.end method

.method public l(Ljava/lang/Class;)Ljava/lang/Object;
    .registers 5
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<T:",
            "Ljava/lang/Object;",
            ">(",
            "Ljava/lang/Class<",
            "TT;>;)TT;"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    invoke-direct {p0}, Lcom/google/api/client/http/HttpResponse;->i()Z

    move-result v0

    if-nez v0, :cond_8

    const/4 p1, 0x0

    return-object p1

    :cond_8
    iget-object v0, p0, Lcom/google/api/client/http/HttpResponse;->h:Lcom/google/api/client/http/HttpRequest;

    invoke-virtual {v0}, Lcom/google/api/client/http/HttpRequest;->h()Lcom/google/api/client/util/ObjectParser;

    move-result-object v0

    invoke-virtual {p0}, Lcom/google/api/client/http/HttpResponse;->b()Ljava/io/InputStream;

    move-result-object v1

    invoke-virtual {p0}, Lcom/google/api/client/http/HttpResponse;->c()Ljava/nio/charset/Charset;

    move-result-object v2

    invoke-interface {v0, v1, v2, p1}, Lcom/google/api/client/util/ObjectParser;->a(Ljava/io/InputStream;Ljava/nio/charset/Charset;Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object p1

    return-object p1
.end method

.method public m()Ljava/lang/String;
    .registers 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    invoke-virtual {p0}, Lcom/google/api/client/http/HttpResponse;->b()Ljava/io/InputStream;

    move-result-object v0

    if-nez v0, :cond_9

    const-string v0, ""

    return-object v0

    :cond_9
    new-instance v1, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v1}, Ljava/io/ByteArrayOutputStream;-><init>()V

    invoke-static {v0, v1}, Lcom/google/api/client/util/IOUtils;->b(Ljava/io/InputStream;Ljava/io/OutputStream;)V

    invoke-virtual {p0}, Lcom/google/api/client/http/HttpResponse;->c()Ljava/nio/charset/Charset;

    move-result-object v0

    invoke-virtual {v0}, Ljava/nio/charset/Charset;->name()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v0}, Ljava/io/ByteArrayOutputStream;->toString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method