GsonRequestBodyConverter.smali
.class final Lretrofit2/converter/gson/GsonRequestBodyConverter;
.super Ljava/lang/Object;
.source "GsonRequestBodyConverter.java"
# interfaces
.implements Lretrofit2/Converter;
# annotations
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">",
"Ljava/lang/Object;",
"Lretrofit2/Converter<",
"TT;",
"Lokhttp3/G;",
">;"
}
.end annotation
# static fields
.field private static final MEDIA_TYPE:Lokhttp3/w;
.field private static final UTF_8:Ljava/nio/charset/Charset;
# instance fields
.field private final adapter:Lcom/google/gson/x;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/google/gson/x<",
"TT;>;"
}
.end annotation
.end field
.field private final gson:Lcom/google/gson/j;
# direct methods
.method static constructor <clinit>()V
.registers 1
const-string v0, "application/json; charset=UTF-8"
.line 1
invoke-static {v0}, Lokhttp3/w;->a(Ljava/lang/String;)Lokhttp3/w;
move-result-object v0
sput-object v0, Lretrofit2/converter/gson/GsonRequestBodyConverter;->MEDIA_TYPE:Lokhttp3/w;
const-string v0, "UTF-8"
.line 2
invoke-static {v0}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
move-result-object v0
sput-object v0, Lretrofit2/converter/gson/GsonRequestBodyConverter;->UTF_8:Ljava/nio/charset/Charset;
return-void
.end method
.method constructor <init>(Lcom/google/gson/j;Lcom/google/gson/x;)V
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/google/gson/j;",
"Lcom/google/gson/x<",
"TT;>;)V"
}
.end annotation
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 2
iput-object p1, p0, Lretrofit2/converter/gson/GsonRequestBodyConverter;->gson:Lcom/google/gson/j;
.line 3
iput-object p2, p0, Lretrofit2/converter/gson/GsonRequestBodyConverter;->adapter:Lcom/google/gson/x;
return-void
.end method
# virtual methods
.method public bridge synthetic convert(Ljava/lang/Object;)Ljava/lang/Object;
.registers 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
invoke-virtual {p0, p1}, Lretrofit2/converter/gson/GsonRequestBodyConverter;->convert(Ljava/lang/Object;)Lokhttp3/G;
move-result-object p1
return-object p1
.end method
.method public convert(Ljava/lang/Object;)Lokhttp3/G;
.registers 6
.annotation system Ldalvik/annotation/Signature;
value = {
"(TT;)",
"Lokhttp3/G;"
}
.end annotation
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 2
new-instance v0, Lokio/Buffer;
invoke-direct {v0}, Lokio/Buffer;-><init>()V
.line 3
new-instance v1, Ljava/io/OutputStreamWriter;
invoke-virtual {v0}, Lokio/Buffer;->outputStream()Ljava/io/OutputStream;
move-result-object v2
sget-object v3, Lretrofit2/converter/gson/GsonRequestBodyConverter;->UTF_8:Ljava/nio/charset/Charset;
invoke-direct {v1, v2, v3}, Ljava/io/OutputStreamWriter;-><init>(Ljava/io/OutputStream;Ljava/nio/charset/Charset;)V
.line 4
iget-object v2, p0, Lretrofit2/converter/gson/GsonRequestBodyConverter;->gson:Lcom/google/gson/j;
invoke-virtual {v2, v1}, Lcom/google/gson/j;->a(Ljava/io/Writer;)Lcom/google/gson/stream/JsonWriter;
move-result-object v1
.line 5
iget-object v2, p0, Lretrofit2/converter/gson/GsonRequestBodyConverter;->adapter:Lcom/google/gson/x;
invoke-virtual {v2, v1, p1}, Lcom/google/gson/x;->a(Lcom/google/gson/stream/JsonWriter;Ljava/lang/Object;)V
.line 6
invoke-virtual {v1}, Lcom/google/gson/stream/JsonWriter;->close()V
.line 7
sget-object p1, Lretrofit2/converter/gson/GsonRequestBodyConverter;->MEDIA_TYPE:Lokhttp3/w;
invoke-virtual {v0}, Lokio/Buffer;->readByteString()Lokio/ByteString;
move-result-object v0
invoke-static {p1, v0}, Lokhttp3/G;->create(Lokhttp3/w;Lokio/ByteString;)Lokhttp3/G;
move-result-object p1
return-object p1
.end method