Segment.smali
.class public final Lokio/Segment;
.super Ljava/lang/Object;
.source "Segment.kt"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lokio/Segment$Companion;
}
.end annotation
.annotation runtime Lkotlin/Metadata;
bv = {
0x1,
0x0,
0x3
}
d1 = {
"\u0000*\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0008\u0002\n\u0002\u0010\u0012\n\u0000\n\u0002\u0010\u0008\n\u0002\u0008\u0002\n\u0002\u0010\u000b\n\u0002\u0008\u0005\n\u0002\u0010\u0002\n\u0002\u0008\u000b\u0008\u0000\u0018\u0000 \u00192\u00020\u0001:\u0001\u0019B\u0007\u0008\u0016\u00a2\u0006\u0002\u0010\u0002B/\u0008\u0016\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\u0006\u0010\u0005\u001a\u00020\u0006\u0012\u0006\u0010\u0007\u001a\u00020\u0006\u0012\u0006\u0010\u0008\u001a\u00020\t\u0012\u0006\u0010\n\u001a\u00020\t\u00a2\u0006\u0002\u0010\u000bJ\u0006\u0010\u000e\u001a\u00020\u000fJ\u0008\u0010\u0010\u001a\u0004\u0018\u00010\u0000J\u000e\u0010\u0011\u001a\u00020\u00002\u0006\u0010\u0012\u001a\u00020\u0000J\u0006\u0010\u0013\u001a\u00020\u0000J\u000e\u0010\u0014\u001a\u00020\u00002\u0006\u0010\u0015\u001a\u00020\u0006J\u0006\u0010\u0016\u001a\u00020\u0000J\u0016\u0010\u0017\u001a\u00020\u000f2\u0006\u0010\u0018\u001a\u00020\u00002\u0006\u0010\u0015\u001a\u00020\u0006R\u0010\u0010\u0003\u001a\u00020\u00048\u0006X\u0087\u0004\u00a2\u0006\u0002\n\u0000R\u0012\u0010\u0007\u001a\u00020\u00068\u0006@\u0006X\u0087\u000e\u00a2\u0006\u0002\n\u0000R\u0014\u0010\u000c\u001a\u0004\u0018\u00010\u00008\u0006@\u0006X\u0087\u000e\u00a2\u0006\u0002\n\u0000R\u0012\u0010\n\u001a\u00020\t8\u0006@\u0006X\u0087\u000e\u00a2\u0006\u0002\n\u0000R\u0012\u0010\u0005\u001a\u00020\u00068\u0006@\u0006X\u0087\u000e\u00a2\u0006\u0002\n\u0000R\u0014\u0010\r\u001a\u0004\u0018\u00010\u00008\u0006@\u0006X\u0087\u000e\u00a2\u0006\u0002\n\u0000R\u0012\u0010\u0008\u001a\u00020\t8\u0006@\u0006X\u0087\u000e\u00a2\u0006\u0002\n\u0000\u00a8\u0006\u001a"
}
d2 = {
"Lokio/Segment;",
"",
"()V",
"data",
"",
"pos",
"",
"limit",
"shared",
"",
"owner",
"([BIIZZ)V",
"next",
"prev",
"compact",
"",
"pop",
"push",
"segment",
"sharedCopy",
"split",
"byteCount",
"unsharedCopy",
"writeTo",
"sink",
"Companion",
"okio"
}
k = 0x1
mv = {
0x1,
0x1,
0x10
}
.end annotation
# static fields
.field public static final Companion:Lokio/Segment$Companion;
.field public static final SHARE_MINIMUM:I = 0x400
.field public static final SIZE:I = 0x2000
# instance fields
.field public final data:[B
.annotation build Lkotlin/jvm/JvmField;
.end annotation
.end field
.field public limit:I
.annotation build Lkotlin/jvm/JvmField;
.end annotation
.end field
.field public next:Lokio/Segment;
.annotation build Lkotlin/jvm/JvmField;
.end annotation
.end field
.field public owner:Z
.annotation build Lkotlin/jvm/JvmField;
.end annotation
.end field
.field public pos:I
.annotation build Lkotlin/jvm/JvmField;
.end annotation
.end field
.field public prev:Lokio/Segment;
.annotation build Lkotlin/jvm/JvmField;
.end annotation
.end field
.field public shared:Z
.annotation build Lkotlin/jvm/JvmField;
.end annotation
.end field
# direct methods
.method public static constructor <clinit>()V
.registers 2
new-instance v0, Lokio/Segment$Companion;
const/4 v1, 0x0
invoke-direct {v0, v1}, Lokio/Segment$Companion;-><init>(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
sput-object v0, Lokio/Segment;->Companion:Lokio/Segment$Companion;
return-void
.end method
.method public constructor <init>()V
.registers 2
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const/16 v0, 0x2000
new-array v0, v0, [B
iput-object v0, p0, Lokio/Segment;->data:[B
const/4 v0, 0x1
iput-boolean v0, p0, Lokio/Segment;->owner:Z
const/4 v0, 0x0
iput-boolean v0, p0, Lokio/Segment;->shared:Z
return-void
.end method
.method public constructor <init>([BIIZZ)V
.registers 6
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Lokio/Segment;->data:[B
iput p2, p0, Lokio/Segment;->pos:I
iput p3, p0, Lokio/Segment;->limit:I
iput-boolean p4, p0, Lokio/Segment;->shared:Z
iput-boolean p5, p0, Lokio/Segment;->owner:Z
return-void
.end method
# virtual methods
.method public final compact()V
.registers 5
iget-object v0, p0, Lokio/Segment;->prev:Lokio/Segment;
const/4 v1, 0x0
if-eq v0, p0, :cond_7
const/4 v0, 0x1
goto :goto_8
:cond_7
const/4 v0, 0x0
:goto_8
if-eqz v0, :cond_52
iget-object v0, p0, Lokio/Segment;->prev:Lokio/Segment;
if-nez v0, :cond_11
invoke-static {}, Lkotlin/jvm/internal/Intrinsics;->throwNpe()V
:cond_11
iget-boolean v0, v0, Lokio/Segment;->owner:Z
if-nez v0, :cond_16
return-void
:cond_16
iget v0, p0, Lokio/Segment;->limit:I
iget v2, p0, Lokio/Segment;->pos:I
sub-int/2addr v0, v2
iget-object v2, p0, Lokio/Segment;->prev:Lokio/Segment;
if-nez v2, :cond_22
invoke-static {}, Lkotlin/jvm/internal/Intrinsics;->throwNpe()V
:cond_22
iget v2, v2, Lokio/Segment;->limit:I
rsub-int v2, v2, 0x2000
iget-object v3, p0, Lokio/Segment;->prev:Lokio/Segment;
if-nez v3, :cond_2d
invoke-static {}, Lkotlin/jvm/internal/Intrinsics;->throwNpe()V
:cond_2d
iget-boolean v3, v3, Lokio/Segment;->shared:Z
if-eqz v3, :cond_32
goto :goto_3b
:cond_32
iget-object v1, p0, Lokio/Segment;->prev:Lokio/Segment;
if-nez v1, :cond_39
invoke-static {}, Lkotlin/jvm/internal/Intrinsics;->throwNpe()V
:cond_39
iget v1, v1, Lokio/Segment;->pos:I
:goto_3b
add-int/2addr v2, v1
if-le v0, v2, :cond_3f
return-void
:cond_3f
iget-object v1, p0, Lokio/Segment;->prev:Lokio/Segment;
if-nez v1, :cond_46
invoke-static {}, Lkotlin/jvm/internal/Intrinsics;->throwNpe()V
:cond_46
invoke-virtual {p0, v1, v0}, Lokio/Segment;->writeTo(Lokio/Segment;I)V
invoke-virtual {p0}, Lokio/Segment;->pop()Lokio/Segment;
sget-object v0, Lokio/SegmentPool;->INSTANCE:Lokio/SegmentPool;
invoke-virtual {v0, p0}, Lokio/SegmentPool;->recycle(Lokio/Segment;)V
return-void
:cond_52
new-instance v0, Ljava/lang/IllegalStateException;
const-string v1, "cannot compact"
invoke-virtual {v1}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method public final pop()Lokio/Segment;
.registers 5
iget-object v0, p0, Lokio/Segment;->next:Lokio/Segment;
const/4 v1, 0x0
if-eq v0, p0, :cond_6
goto :goto_7
:cond_6
move-object v0, v1
:goto_7
iget-object v2, p0, Lokio/Segment;->prev:Lokio/Segment;
if-nez v2, :cond_e
invoke-static {}, Lkotlin/jvm/internal/Intrinsics;->throwNpe()V
:cond_e
iget-object v3, p0, Lokio/Segment;->next:Lokio/Segment;
iput-object v3, v2, Lokio/Segment;->next:Lokio/Segment;
iget-object v2, p0, Lokio/Segment;->next:Lokio/Segment;
if-nez v2, :cond_19
invoke-static {}, Lkotlin/jvm/internal/Intrinsics;->throwNpe()V
:cond_19
iget-object v3, p0, Lokio/Segment;->prev:Lokio/Segment;
iput-object v3, v2, Lokio/Segment;->prev:Lokio/Segment;
iput-object v1, p0, Lokio/Segment;->next:Lokio/Segment;
iput-object v1, p0, Lokio/Segment;->prev:Lokio/Segment;
return-object v0
.end method
.method public final push(Lokio/Segment;)Lokio/Segment;
.registers 3
iput-object p0, p1, Lokio/Segment;->prev:Lokio/Segment;
iget-object v0, p0, Lokio/Segment;->next:Lokio/Segment;
iput-object v0, p1, Lokio/Segment;->next:Lokio/Segment;
iget-object v0, p0, Lokio/Segment;->next:Lokio/Segment;
if-nez v0, :cond_d
invoke-static {}, Lkotlin/jvm/internal/Intrinsics;->throwNpe()V
:cond_d
iput-object p1, v0, Lokio/Segment;->prev:Lokio/Segment;
iput-object p1, p0, Lokio/Segment;->next:Lokio/Segment;
return-object p1
.end method
.method public final sharedCopy()Lokio/Segment;
.registers 8
const/4 v0, 0x1
iput-boolean v0, p0, Lokio/Segment;->shared:Z
new-instance v0, Lokio/Segment;
iget-object v2, p0, Lokio/Segment;->data:[B
iget v3, p0, Lokio/Segment;->pos:I
iget v4, p0, Lokio/Segment;->limit:I
const/4 v5, 0x1
const/4 v6, 0x0
move-object v1, v0
invoke-direct/range {v1 .. v6}, Lokio/Segment;-><init>([BIIZZ)V
return-object v0
.end method
.method public final split(I)Lokio/Segment;
.registers 10
if-lez p1, :cond_b
iget v0, p0, Lokio/Segment;->limit:I
iget v1, p0, Lokio/Segment;->pos:I
sub-int/2addr v0, v1
if-gt p1, v0, :cond_b
const/4 v0, 0x1
goto :goto_c
:cond_b
const/4 v0, 0x0
:goto_c
if-eqz v0, :cond_40
const/16 v0, 0x400
if-lt p1, v0, :cond_17
invoke-virtual {p0}, Lokio/Segment;->sharedCopy()Lokio/Segment;
move-result-object v0
goto :goto_2b
:cond_17
sget-object v0, Lokio/SegmentPool;->INSTANCE:Lokio/SegmentPool;
invoke-virtual {v0}, Lokio/SegmentPool;->take()Lokio/Segment;
move-result-object v0
iget-object v1, p0, Lokio/Segment;->data:[B
iget-object v2, v0, Lokio/Segment;->data:[B
const/4 v3, 0x0
iget v4, p0, Lokio/Segment;->pos:I
add-int v5, v4, p1
const/4 v6, 0x2
const/4 v7, 0x0
invoke-static/range {v1 .. v7}, Lkotlin/collections/ArraysKt___ArraysJvmKt;->copyInto$default([B[BIIIILjava/lang/Object;)[B
:goto_2b
iget v1, v0, Lokio/Segment;->pos:I
add-int/2addr v1, p1
iput v1, v0, Lokio/Segment;->limit:I
iget v1, p0, Lokio/Segment;->pos:I
add-int/2addr v1, p1
iput v1, p0, Lokio/Segment;->pos:I
iget-object p1, p0, Lokio/Segment;->prev:Lokio/Segment;
if-nez p1, :cond_3c
invoke-static {}, Lkotlin/jvm/internal/Intrinsics;->throwNpe()V
:cond_3c
invoke-virtual {p1, v0}, Lokio/Segment;->push(Lokio/Segment;)Lokio/Segment;
return-object v0
:cond_40
new-instance p1, Ljava/lang/IllegalArgumentException;
const-string v0, "byteCount out of range"
invoke-virtual {v0}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object v0
invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
.end method
.method public final unsharedCopy()Lokio/Segment;
.registers 9
iget-object v0, p0, Lokio/Segment;->data:[B
array-length v1, v0
invoke-static {v0, v1}, Ljava/util/Arrays;->copyOf([BI)[B
move-result-object v3
const-string v0, "java.util.Arrays.copyOf(this, size)"
invoke-static {v3, v0}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
iget v4, p0, Lokio/Segment;->pos:I
iget v5, p0, Lokio/Segment;->limit:I
new-instance v0, Lokio/Segment;
const/4 v6, 0x0
const/4 v7, 0x1
move-object v2, v0
invoke-direct/range {v2 .. v7}, Lokio/Segment;-><init>([BIIZZ)V
return-object v0
.end method
.method public final writeTo(Lokio/Segment;I)V
.registers 11
iget-boolean v0, p1, Lokio/Segment;->owner:Z
if-eqz v0, :cond_4f
iget v5, p1, Lokio/Segment;->limit:I
add-int v0, v5, p2
const/16 v1, 0x2000
if-le v0, v1, :cond_37
iget-boolean v0, p1, Lokio/Segment;->shared:Z
if-nez v0, :cond_31
add-int v0, v5, p2
iget v4, p1, Lokio/Segment;->pos:I
sub-int/2addr v0, v4
if-gt v0, v1, :cond_2b
iget-object v2, p1, Lokio/Segment;->data:[B
const/4 v3, 0x0
const/4 v6, 0x2
const/4 v7, 0x0
move-object v1, v2
invoke-static/range {v1 .. v7}, Lkotlin/collections/ArraysKt___ArraysJvmKt;->copyInto$default([B[BIIIILjava/lang/Object;)[B
iget v0, p1, Lokio/Segment;->limit:I
iget v1, p1, Lokio/Segment;->pos:I
sub-int/2addr v0, v1
iput v0, p1, Lokio/Segment;->limit:I
const/4 v0, 0x0
iput v0, p1, Lokio/Segment;->pos:I
goto :goto_37
:cond_2b
new-instance p1, Ljava/lang/IllegalArgumentException;
invoke-direct {p1}, Ljava/lang/IllegalArgumentException;-><init>()V
throw p1
:cond_31
new-instance p1, Ljava/lang/IllegalArgumentException;
invoke-direct {p1}, Ljava/lang/IllegalArgumentException;-><init>()V
throw p1
:cond_37
:goto_37
iget-object v0, p0, Lokio/Segment;->data:[B
iget-object v1, p1, Lokio/Segment;->data:[B
iget v2, p1, Lokio/Segment;->limit:I
iget v3, p0, Lokio/Segment;->pos:I
add-int v4, v3, p2
invoke-static {v0, v1, v2, v3, v4}, Lkotlin/collections/ArraysKt___ArraysJvmKt;->copyInto([B[BIII)[B
iget v0, p1, Lokio/Segment;->limit:I
add-int/2addr v0, p2
iput v0, p1, Lokio/Segment;->limit:I
iget p1, p0, Lokio/Segment;->pos:I
add-int/2addr p1, p2
iput p1, p0, Lokio/Segment;->pos:I
return-void
:cond_4f
new-instance p1, Ljava/lang/IllegalStateException;
const-string p2, "only owner can write"
invoke-virtual {p2}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object p2
invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p1
.end method