443 lines
13 KiB
Smali
443 lines
13 KiB
Smali
.class public Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;
|
|
.super Lcom/esotericsoftware/kryo/Serializer;
|
|
.source "CollectionSerializer.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/esotericsoftware/kryo/serializers/CollectionSerializer$BindCollection;
|
|
}
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lcom/esotericsoftware/kryo/Serializer<",
|
|
"Ljava/util/Collection;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field public elementClass:Ljava/lang/Class;
|
|
|
|
.field public elementsCanBeNull:Z
|
|
|
|
.field public genericType:Ljava/lang/Class;
|
|
|
|
.field public serializer:Lcom/esotericsoftware/kryo/Serializer;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>()V
|
|
.locals 1
|
|
|
|
invoke-direct {p0}, Lcom/esotericsoftware/kryo/Serializer;-><init>()V
|
|
|
|
const/4 v0, 0x1
|
|
|
|
iput-boolean v0, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->elementsCanBeNull:Z
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Ljava/lang/Class;Lcom/esotericsoftware/kryo/Serializer;)V
|
|
.locals 1
|
|
|
|
invoke-direct {p0}, Lcom/esotericsoftware/kryo/Serializer;-><init>()V
|
|
|
|
const/4 v0, 0x1
|
|
|
|
iput-boolean v0, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->elementsCanBeNull:Z
|
|
|
|
invoke-virtual {p0, p1, p2}, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->setElementClass(Ljava/lang/Class;Lcom/esotericsoftware/kryo/Serializer;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Ljava/lang/Class;Lcom/esotericsoftware/kryo/Serializer;Z)V
|
|
.locals 1
|
|
|
|
invoke-direct {p0}, Lcom/esotericsoftware/kryo/Serializer;-><init>()V
|
|
|
|
const/4 v0, 0x1
|
|
|
|
iput-boolean v0, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->elementsCanBeNull:Z
|
|
|
|
invoke-virtual {p0, p1, p2}, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->setElementClass(Ljava/lang/Class;Lcom/esotericsoftware/kryo/Serializer;)V
|
|
|
|
iput-boolean p3, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->elementsCanBeNull:Z
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public bridge synthetic copy(Lcom/esotericsoftware/kryo/Kryo;Ljava/lang/Object;)Ljava/lang/Object;
|
|
.locals 0
|
|
|
|
check-cast p2, Ljava/util/Collection;
|
|
|
|
invoke-virtual {p0, p1, p2}, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->copy(Lcom/esotericsoftware/kryo/Kryo;Ljava/util/Collection;)Ljava/util/Collection;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public copy(Lcom/esotericsoftware/kryo/Kryo;Ljava/util/Collection;)Ljava/util/Collection;
|
|
.locals 2
|
|
|
|
invoke-virtual {p0, p1, p2}, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->createCopy(Lcom/esotericsoftware/kryo/Kryo;Ljava/util/Collection;)Ljava/util/Collection;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p1, v0}, Lcom/esotericsoftware/kryo/Kryo;->reference(Ljava/lang/Object;)V
|
|
|
|
invoke-interface {p2}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p2
|
|
|
|
:goto_0
|
|
invoke-interface {p2}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
invoke-interface {p2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {p1, v1}, Lcom/esotericsoftware/kryo/Kryo;->copy(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-interface {v0, v1}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public create(Lcom/esotericsoftware/kryo/Kryo;Lcom/esotericsoftware/kryo/io/Input;Ljava/lang/Class;)Ljava/util/Collection;
|
|
.locals 0
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/esotericsoftware/kryo/Kryo;",
|
|
"Lcom/esotericsoftware/kryo/io/Input;",
|
|
"Ljava/lang/Class<",
|
|
"Ljava/util/Collection;",
|
|
">;)",
|
|
"Ljava/util/Collection;"
|
|
}
|
|
.end annotation
|
|
|
|
invoke-virtual {p1, p3}, Lcom/esotericsoftware/kryo/Kryo;->newInstance(Ljava/lang/Class;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Ljava/util/Collection;
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public createCopy(Lcom/esotericsoftware/kryo/Kryo;Ljava/util/Collection;)Ljava/util/Collection;
|
|
.locals 0
|
|
|
|
invoke-virtual {p2}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {p1, p2}, Lcom/esotericsoftware/kryo/Kryo;->newInstance(Ljava/lang/Class;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Ljava/util/Collection;
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public bridge synthetic read(Lcom/esotericsoftware/kryo/Kryo;Lcom/esotericsoftware/kryo/io/Input;Ljava/lang/Class;)Ljava/lang/Object;
|
|
.locals 0
|
|
|
|
invoke-virtual {p0, p1, p2, p3}, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->read(Lcom/esotericsoftware/kryo/Kryo;Lcom/esotericsoftware/kryo/io/Input;Ljava/lang/Class;)Ljava/util/Collection;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public read(Lcom/esotericsoftware/kryo/Kryo;Lcom/esotericsoftware/kryo/io/Input;Ljava/lang/Class;)Ljava/util/Collection;
|
|
.locals 5
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/esotericsoftware/kryo/Kryo;",
|
|
"Lcom/esotericsoftware/kryo/io/Input;",
|
|
"Ljava/lang/Class<",
|
|
"Ljava/util/Collection;",
|
|
">;)",
|
|
"Ljava/util/Collection;"
|
|
}
|
|
.end annotation
|
|
|
|
invoke-virtual {p0, p1, p2, p3}, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->create(Lcom/esotericsoftware/kryo/Kryo;Lcom/esotericsoftware/kryo/io/Input;Ljava/lang/Class;)Ljava/util/Collection;
|
|
|
|
move-result-object p3
|
|
|
|
invoke-virtual {p1, p3}, Lcom/esotericsoftware/kryo/Kryo;->reference(Ljava/lang/Object;)V
|
|
|
|
const/4 v0, 0x1
|
|
|
|
invoke-virtual {p2, v0}, Lcom/esotericsoftware/kryo/io/Input;->readVarInt(Z)I
|
|
|
|
move-result v0
|
|
|
|
instance-of v1, p3, Ljava/util/ArrayList;
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
move-object v1, p3
|
|
|
|
check-cast v1, Ljava/util/ArrayList;
|
|
|
|
invoke-virtual {v1, v0}, Ljava/util/ArrayList;->ensureCapacity(I)V
|
|
|
|
:cond_0
|
|
iget-object v1, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->elementClass:Ljava/lang/Class;
|
|
|
|
iget-object v2, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->serializer:Lcom/esotericsoftware/kryo/Serializer;
|
|
|
|
iget-object v3, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->genericType:Ljava/lang/Class;
|
|
|
|
if-eqz v3, :cond_2
|
|
|
|
if-nez v2, :cond_1
|
|
|
|
invoke-virtual {p1, v3}, Lcom/esotericsoftware/kryo/Kryo;->getSerializer(Ljava/lang/Class;)Lcom/esotericsoftware/kryo/Serializer;
|
|
|
|
move-result-object v1
|
|
|
|
move-object v2, v1
|
|
|
|
move-object v1, v3
|
|
|
|
:cond_1
|
|
const/4 v3, 0x0
|
|
|
|
iput-object v3, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->genericType:Ljava/lang/Class;
|
|
|
|
:cond_2
|
|
const/4 v3, 0x0
|
|
|
|
if-eqz v2, :cond_4
|
|
|
|
iget-boolean v4, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->elementsCanBeNull:Z
|
|
|
|
if-eqz v4, :cond_3
|
|
|
|
:goto_0
|
|
if-ge v3, v0, :cond_5
|
|
|
|
invoke-virtual {p1, p2, v1, v2}, Lcom/esotericsoftware/kryo/Kryo;->readObjectOrNull(Lcom/esotericsoftware/kryo/io/Input;Ljava/lang/Class;Lcom/esotericsoftware/kryo/Serializer;)Ljava/lang/Object;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-interface {p3, v4}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
|
|
|
|
add-int/lit8 v3, v3, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_3
|
|
:goto_1
|
|
if-ge v3, v0, :cond_5
|
|
|
|
invoke-virtual {p1, p2, v1, v2}, Lcom/esotericsoftware/kryo/Kryo;->readObject(Lcom/esotericsoftware/kryo/io/Input;Ljava/lang/Class;Lcom/esotericsoftware/kryo/Serializer;)Ljava/lang/Object;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-interface {p3, v4}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
|
|
|
|
add-int/lit8 v3, v3, 0x1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_4
|
|
:goto_2
|
|
if-ge v3, v0, :cond_5
|
|
|
|
invoke-virtual {p1, p2}, Lcom/esotericsoftware/kryo/Kryo;->readClassAndObject(Lcom/esotericsoftware/kryo/io/Input;)Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-interface {p3, v1}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
|
|
|
|
add-int/lit8 v3, v3, 0x1
|
|
|
|
goto :goto_2
|
|
|
|
:cond_5
|
|
return-object p3
|
|
.end method
|
|
|
|
.method public setElementClass(Ljava/lang/Class;Lcom/esotericsoftware/kryo/Serializer;)V
|
|
.locals 0
|
|
|
|
iput-object p1, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->elementClass:Ljava/lang/Class;
|
|
|
|
iput-object p2, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->serializer:Lcom/esotericsoftware/kryo/Serializer;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setElementsCanBeNull(Z)V
|
|
.locals 0
|
|
|
|
iput-boolean p1, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->elementsCanBeNull:Z
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setGenerics(Lcom/esotericsoftware/kryo/Kryo;[Ljava/lang/Class;)V
|
|
.locals 2
|
|
|
|
const/4 v0, 0x0
|
|
|
|
iput-object v0, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->genericType:Ljava/lang/Class;
|
|
|
|
if-eqz p2, :cond_0
|
|
|
|
array-length v0, p2
|
|
|
|
if-lez v0, :cond_0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
aget-object v1, p2, v0
|
|
|
|
invoke-virtual {p1, v1}, Lcom/esotericsoftware/kryo/Kryo;->isFinal(Ljava/lang/Class;)Z
|
|
|
|
move-result p1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
aget-object p1, p2, v0
|
|
|
|
iput-object p1, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->genericType:Ljava/lang/Class;
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public bridge synthetic write(Lcom/esotericsoftware/kryo/Kryo;Lcom/esotericsoftware/kryo/io/Output;Ljava/lang/Object;)V
|
|
.locals 0
|
|
|
|
check-cast p3, Ljava/util/Collection;
|
|
|
|
invoke-virtual {p0, p1, p2, p3}, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->write(Lcom/esotericsoftware/kryo/Kryo;Lcom/esotericsoftware/kryo/io/Output;Ljava/util/Collection;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public write(Lcom/esotericsoftware/kryo/Kryo;Lcom/esotericsoftware/kryo/io/Output;Ljava/util/Collection;)V
|
|
.locals 2
|
|
|
|
invoke-interface {p3}, Ljava/util/Collection;->size()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
invoke-virtual {p2, v0, v1}, Lcom/esotericsoftware/kryo/io/Output;->writeVarInt(IZ)I
|
|
|
|
iget-object v0, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->serializer:Lcom/esotericsoftware/kryo/Serializer;
|
|
|
|
iget-object v1, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->genericType:Ljava/lang/Class;
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
invoke-virtual {p1, v1}, Lcom/esotericsoftware/kryo/Kryo;->getSerializer(Ljava/lang/Class;)Lcom/esotericsoftware/kryo/Serializer;
|
|
|
|
move-result-object v0
|
|
|
|
:cond_0
|
|
const/4 v1, 0x0
|
|
|
|
iput-object v1, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->genericType:Ljava/lang/Class;
|
|
|
|
:cond_1
|
|
if-eqz v0, :cond_3
|
|
|
|
iget-boolean v1, p0, Lcom/esotericsoftware/kryo/serializers/CollectionSerializer;->elementsCanBeNull:Z
|
|
|
|
if-eqz v1, :cond_2
|
|
|
|
invoke-interface {p3}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p3
|
|
|
|
:goto_0
|
|
invoke-interface {p3}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_4
|
|
|
|
invoke-interface {p3}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {p1, p2, v1, v0}, Lcom/esotericsoftware/kryo/Kryo;->writeObjectOrNull(Lcom/esotericsoftware/kryo/io/Output;Ljava/lang/Object;Lcom/esotericsoftware/kryo/Serializer;)V
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
invoke-interface {p3}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p3
|
|
|
|
:goto_1
|
|
invoke-interface {p3}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_4
|
|
|
|
invoke-interface {p3}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {p1, p2, v1, v0}, Lcom/esotericsoftware/kryo/Kryo;->writeObject(Lcom/esotericsoftware/kryo/io/Output;Ljava/lang/Object;Lcom/esotericsoftware/kryo/Serializer;)V
|
|
|
|
goto :goto_1
|
|
|
|
:cond_3
|
|
invoke-interface {p3}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p3
|
|
|
|
:goto_2
|
|
invoke-interface {p3}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_4
|
|
|
|
invoke-interface {p3}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p1, p2, v0}, Lcom/esotericsoftware/kryo/Kryo;->writeClassAndObject(Lcom/esotericsoftware/kryo/io/Output;Ljava/lang/Object;)V
|
|
|
|
goto :goto_2
|
|
|
|
:cond_4
|
|
return-void
|
|
.end method
|