InflaterSource.smali
.class public final Lokio/InflaterSource;
.super Ljava/lang/Object;
# interfaces
.implements Lokio/Source;
# instance fields
.field private f:I
.field private g:Z
.field private final h:Lokio/BufferedSource;
.field private final i:Ljava/util/zip/Inflater;
# direct methods
.method public constructor <init>(Lokio/BufferedSource;Ljava/util/zip/Inflater;)V
.registers 4
const-string v0, "source"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->c(Ljava/lang/Object;Ljava/lang/String;)V
const-string v0, "inflater"
invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->c(Ljava/lang/Object;Ljava/lang/String;)V
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Lokio/InflaterSource;->h:Lokio/BufferedSource;
iput-object p2, p0, Lokio/InflaterSource;->i:Ljava/util/zip/Inflater;
return-void
.end method
.method private final d()V
.registers 5
iget v0, p0, Lokio/InflaterSource;->f:I
if-nez v0, :cond_5
return-void
:cond_5
iget-object v1, p0, Lokio/InflaterSource;->i:Ljava/util/zip/Inflater;
invoke-virtual {v1}, Ljava/util/zip/Inflater;->getRemaining()I
move-result v1
sub-int/2addr v0, v1
iget v1, p0, Lokio/InflaterSource;->f:I
sub-int/2addr v1, v0
iput v1, p0, Lokio/InflaterSource;->f:I
iget-object v1, p0, Lokio/InflaterSource;->h:Lokio/BufferedSource;
int-to-long v2, v0
invoke-interface {v1, v2, v3}, Lokio/BufferedSource;->N0(J)V
return-void
.end method
# virtual methods
.method public final a(Lokio/Buffer;J)J
.registers 9
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
const-string v0, "sink"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->c(Ljava/lang/Object;Ljava/lang/String;)V
const/4 v0, 0x1
const-wide/16 v1, 0x0
cmp-long v3, p2, v1
if-ltz v3, :cond_e
const/4 v4, 0x1
goto :goto_f
:cond_e
const/4 v4, 0x0
:goto_f
if-eqz v4, :cond_6d
iget-boolean v4, p0, Lokio/InflaterSource;->g:Z
xor-int/2addr v4, v0
if-eqz v4, :cond_61
if-nez v3, :cond_19
return-wide v1
:cond_19
:try_start_19
invoke-virtual {p1, v0}, Lokio/Buffer;->S(I)Lokio/Segment;
move-result-object v0
iget v3, v0, Lokio/Segment;->c:I
rsub-int v3, v3, 0x2000
int-to-long v3, v3
invoke-static {p2, p3, v3, v4}, Ljava/lang/Math;->min(JJ)J
move-result-wide p2
long-to-int p3, p2
invoke-virtual {p0}, Lokio/InflaterSource;->b()Z
iget-object p2, p0, Lokio/InflaterSource;->i:Ljava/util/zip/Inflater;
iget-object v3, v0, Lokio/Segment;->a:[B
iget v4, v0, Lokio/Segment;->c:I
invoke-virtual {p2, v3, v4, p3}, Ljava/util/zip/Inflater;->inflate([BII)I
move-result p2
invoke-direct {p0}, Lokio/InflaterSource;->d()V
if-lez p2, :cond_48
iget p3, v0, Lokio/Segment;->c:I
add-int/2addr p3, p2
iput p3, v0, Lokio/Segment;->c:I
invoke-virtual {p1}, Lokio/Buffer;->size()J
move-result-wide v0
int-to-long p2, p2
add-long/2addr v0, p2
invoke-virtual {p1, v0, v1}, Lokio/Buffer;->J(J)V
return-wide p2
:cond_48
iget p2, v0, Lokio/Segment;->b:I
iget p3, v0, Lokio/Segment;->c:I
if-ne p2, p3, :cond_59
invoke-virtual {v0}, Lokio/Segment;->b()Lokio/Segment;
move-result-object p2
iput-object p2, p1, Lokio/Buffer;->f:Lokio/Segment;
sget-object p1, Lokio/SegmentPool;->c:Lokio/SegmentPool;
invoke-virtual {p1, v0}, Lokio/SegmentPool;->a(Lokio/Segment;)V
:try_end_59
.catch Ljava/util/zip/DataFormatException; {:try_start_19 .. :try_end_59} :catch_5a
:cond_59
return-wide v1
:catch_5a
move-exception p1
new-instance p2, Ljava/io/IOException;
invoke-direct {p2, p1}, Ljava/io/IOException;-><init>(Ljava/lang/Throwable;)V
throw p2
:cond_61
new-instance p1, Ljava/lang/IllegalStateException;
const-string p2, "closed"
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
:cond_6d
new-instance p1, Ljava/lang/StringBuilder;
invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V
const-string v0, "byteCount < 0: "
invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p1, p2, p3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
new-instance p2, Ljava/lang/IllegalArgumentException;
invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {p2, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p2
.end method
.method public final b()Z
.registers 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
iget-object v0, p0, Lokio/InflaterSource;->i:Ljava/util/zip/Inflater;
invoke-virtual {v0}, Ljava/util/zip/Inflater;->needsInput()Z
move-result v0
const/4 v1, 0x0
if-nez v0, :cond_a
return v1
:cond_a
iget-object v0, p0, Lokio/InflaterSource;->h:Lokio/BufferedSource;
invoke-interface {v0}, Lokio/BufferedSource;->N()Z
move-result v0
if-eqz v0, :cond_14
const/4 v0, 0x1
return v0
:cond_14
iget-object v0, p0, Lokio/InflaterSource;->h:Lokio/BufferedSource;
invoke-interface {v0}, Lokio/BufferedSource;->c()Lokio/Buffer;
move-result-object v0
iget-object v0, v0, Lokio/Buffer;->f:Lokio/Segment;
if-eqz v0, :cond_2d
iget v2, v0, Lokio/Segment;->c:I
iget v3, v0, Lokio/Segment;->b:I
sub-int/2addr v2, v3
iput v2, p0, Lokio/InflaterSource;->f:I
iget-object v4, p0, Lokio/InflaterSource;->i:Ljava/util/zip/Inflater;
iget-object v0, v0, Lokio/Segment;->a:[B
invoke-virtual {v4, v0, v3, v2}, Ljava/util/zip/Inflater;->setInput([BII)V
return v1
:cond_2d
invoke-static {}, Lkotlin/jvm/internal/Intrinsics;->h()V
const/4 v0, 0x0
throw v0
.end method
.method public close()V
.registers 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
iget-boolean v0, p0, Lokio/InflaterSource;->g:Z
if-eqz v0, :cond_5
return-void
:cond_5
iget-object v0, p0, Lokio/InflaterSource;->i:Ljava/util/zip/Inflater;
invoke-virtual {v0}, Ljava/util/zip/Inflater;->end()V
const/4 v0, 0x1
iput-boolean v0, p0, Lokio/InflaterSource;->g:Z
iget-object v0, p0, Lokio/InflaterSource;->h:Lokio/BufferedSource;
invoke-interface {v0}, Lokio/Source;->close()V
return-void
.end method
.method public o1(Lokio/Buffer;J)J
.registers 9
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
const-string v0, "sink"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->c(Ljava/lang/Object;Ljava/lang/String;)V
:goto_5
invoke-virtual {p0, p1, p2, p3}, Lokio/InflaterSource;->a(Lokio/Buffer;J)J
move-result-wide v0
const-wide/16 v2, 0x0
cmp-long v4, v0, v2
if-lez v4, :cond_10
return-wide v0
:cond_10
iget-object v0, p0, Lokio/InflaterSource;->i:Ljava/util/zip/Inflater;
invoke-virtual {v0}, Ljava/util/zip/Inflater;->finished()Z
move-result v0
if-nez v0, :cond_32
iget-object v0, p0, Lokio/InflaterSource;->i:Ljava/util/zip/Inflater;
invoke-virtual {v0}, Ljava/util/zip/Inflater;->needsDictionary()Z
move-result v0
if-eqz v0, :cond_21
goto :goto_32
:cond_21
iget-object v0, p0, Lokio/InflaterSource;->h:Lokio/BufferedSource;
invoke-interface {v0}, Lokio/BufferedSource;->N()Z
move-result v0
if-nez v0, :cond_2a
goto :goto_5
:cond_2a
new-instance p1, Ljava/io/EOFException;
const-string p2, "source exhausted prematurely"
invoke-direct {p1, p2}, Ljava/io/EOFException;-><init>(Ljava/lang/String;)V
throw p1
:cond_32
:goto_32
const-wide/16 p1, -0x1
return-wide p1
.end method
.method public timeout()Lokio/Timeout;
.registers 2
iget-object v0, p0, Lokio/InflaterSource;->h:Lokio/BufferedSource;
invoke-interface {v0}, Lokio/Source;->timeout()Lokio/Timeout;
move-result-object v0
return-object v0
.end method