granularity level: instruction
.class public Lcom/google/firebase/encoders/proto/ProtobufEncoder;
.super Ljava/lang/Object;
.source "ProtobufEncoder.java"
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/google/firebase/encoders/proto/ProtobufEncoder$Builder;
}
.end annotation
.field private final fallbackEncoder:Lcom/google/firebase/encoders/ObjectEncoder;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/google/firebase/encoders/ObjectEncoder<",
"Ljava/lang/Object;",
">;"
}
.end annotation
.end field
.field private final objectEncoders:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/Class<",
"*>;",
"Lcom/google/firebase/encoders/ObjectEncoder<",
"*>;>;"
}
.end annotation
.end field
.field private final valueEncoders:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/Class<",
"*>;",
"Lcom/google/firebase/encoders/ValueEncoder<",
"*>;>;"
}
.end annotation
.end field
.method constructor <init>(Ljava/util/Map;Ljava/util/Map;Lcom/google/firebase/encoders/ObjectEncoder;)V
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/Map<",
"Ljava/lang/Class<",
"*>;",
"Lcom/google/firebase/encoders/ObjectEncoder<",
"*>;>;",
"Ljava/util/Map<",
"Ljava/lang/Class<",
"*>;",
"Lcom/google/firebase/encoders/ValueEncoder<",
"*>;>;",
"Lcom/google/firebase/encoders/ObjectEncoder<",
"Ljava/lang/Object;",
">;)V"
}
.end annotation
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Lcom/google/firebase/encoders/proto/ProtobufEncoder;->objectEncoders:Ljava/util/Map;
iput-object p2, p0, Lcom/google/firebase/encoders/proto/ProtobufEncoder;->valueEncoders:Ljava/util/Map;
iput-object p3, p0, Lcom/google/firebase/encoders/proto/ProtobufEncoder;->fallbackEncoder:Lcom/google/firebase/encoders/ObjectEncoder;
return-void
.end method
.method public static builder()Lcom/google/firebase/encoders/proto/ProtobufEncoder$Builder;
.locals 1
new-instance v0, Lcom/google/firebase/encoders/proto/ProtobufEncoder$Builder;
invoke-direct {v0}, Lcom/google/firebase/encoders/proto/ProtobufEncoder$Builder;-><init>()V
return-object v0
.end method
.method public encode(Ljava/lang/Object;Ljava/io/OutputStream;)V
.locals 4
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
new-instance v0, Lcom/google/firebase/encoders/proto/ProtobufDataEncoderContext;
iget-object v1, p0, Lcom/google/firebase/encoders/proto/ProtobufEncoder;->objectEncoders:Ljava/util/Map;
iget-object v2, p0, Lcom/google/firebase/encoders/proto/ProtobufEncoder;->valueEncoders:Ljava/util/Map;
iget-object v3, p0, Lcom/google/firebase/encoders/proto/ProtobufEncoder;->fallbackEncoder:Lcom/google/firebase/encoders/ObjectEncoder;
invoke-direct {v0, p2, v1, v2, v3}, Lcom/google/firebase/encoders/proto/ProtobufDataEncoderContext;-><init>(Ljava/io/OutputStream;Ljava/util/Map;Ljava/util/Map;Lcom/google/firebase/encoders/ObjectEncoder;)V
invoke-virtual {v0, p1}, Lcom/google/firebase/encoders/proto/ProtobufDataEncoderContext;->encode(Ljava/lang/Object;)Lcom/google/firebase/encoders/proto/ProtobufDataEncoderContext;
return-void
.end method
.method public encode(Ljava/lang/Object;)[B
.locals 1
new-instance v0, Ljava/io/ByteArrayOutputStream;
invoke-direct {v0}, Ljava/io/ByteArrayOutputStream;-><init>()V
:try_start_0
invoke-virtual {p0, p1, v0}, Lcom/google/firebase/encoders/proto/ProtobufEncoder;->encode(Ljava/lang/Object;Ljava/io/OutputStream;)V
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
:catch_0
invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
move-result-object p1
return-object p1
.end method