.class public final Lokio/PeekSource; .super Ljava/lang/Object; .source "PeekSource.kt" # interfaces .implements Lokio/Source; # annotations .annotation system Ldalvik/annotation/SourceDebugExtension; value = "SMAP\nPeekSource.kt\nKotlin\n*S Kotlin\n*F\n+ 1 PeekSource.kt\nokio/PeekSource\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,72:1\n1#2:73\n*E\n" .end annotation .annotation runtime Lkotlin/Metadata; bv = { 0x1, 0x0, 0x3 } d1 = { "\u0000>\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0008\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u0002\n\u0002\u0008\u0004\n\u0002\u0018\u0002\n\u0000\u0008\u0000\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u00a2\u0006\u0002\u0010\u0004J\u0008\u0010\u000f\u001a\u00020\u0010H\u0016J\u0018\u0010\u0011\u001a\u00020\u000e2\u0006\u0010\u0012\u001a\u00020\u00062\u0006\u0010\u0013\u001a\u00020\u000eH\u0016J\u0008\u0010\u0014\u001a\u00020\u0015H\u0016R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0008X\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\nX\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u0010\u0010\u000b\u001a\u0004\u0018\u00010\u000cX\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u000eX\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004\u00a2\u0006\u0002\n\u0000\u00a8\u0006\u0016" } d2 = { "Lokio/PeekSource;", "Lokio/Source;", "upstream", "Lokio/BufferedSource;", "(Lokio/BufferedSource;)V", "buffer", "Lokio/Buffer;", "closed", "", "expectedPos", "", "expectedSegment", "Lokio/Segment;", "pos", "", "close", "", "read", "sink", "byteCount", "timeout", "Lokio/Timeout;", "okio" } k = 0x1 mv = { 0x1, 0x4, 0x0 } .end annotation # instance fields .field private final buffer:Lokio/Buffer; .field private closed:Z .field private expectedPos:I .field private expectedSegment:Lokio/Segment; .field private pos:J .field private final upstream:Lokio/BufferedSource; # direct methods .method public constructor (Lokio/BufferedSource;)V .locals 1 const-string v0, "upstream" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 28 invoke-direct {p0}, Ljava/lang/Object;->()V iput-object p1, p0, Lokio/PeekSource;->upstream:Lokio/BufferedSource; .line 31 invoke-interface {p1}, Lokio/BufferedSource;->getBuffer()Lokio/Buffer; move-result-object p1 iput-object p1, p0, Lokio/PeekSource;->buffer:Lokio/Buffer; .line 32 iget-object v0, p1, Lokio/Buffer;->head:Lokio/Segment; iput-object v0, p0, Lokio/PeekSource;->expectedSegment:Lokio/Segment; .line 33 iget-object p1, p1, Lokio/Buffer;->head:Lokio/Segment; if-eqz p1, :cond_0 iget p1, p1, Lokio/Segment;->pos:I goto :goto_0 :cond_0 const/4 p1, -0x1 :goto_0 iput p1, p0, Lokio/PeekSource;->expectedPos:I return-void .end method # virtual methods .method public close()V .locals 1 const/4 v0, 0x1 iput-boolean v0, p0, Lokio/PeekSource;->closed:Z return-void .end method .method public read(Lokio/Buffer;J)J .locals 8 const-string v0, "sink" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const-wide/16 v0, 0x0 cmp-long v2, p2, v0 const/4 v3, 0x0 const/4 v4, 0x1 if-ltz v2, :cond_0 move v5, v4 goto :goto_0 :cond_0 move v5, v3 :goto_0 if-eqz v5, :cond_8 iget-boolean v5, p0, Lokio/PeekSource;->closed:Z xor-int/2addr v5, v4 if-eqz v5, :cond_7 iget-object v5, p0, Lokio/PeekSource;->expectedSegment:Lokio/Segment; if-eqz v5, :cond_1 iget-object v6, p0, Lokio/PeekSource;->buffer:Lokio/Buffer; .line 44 iget-object v6, v6, Lokio/Buffer;->head:Lokio/Segment; if-ne v5, v6, :cond_2 iget v5, p0, Lokio/PeekSource;->expectedPos:I iget-object v6, p0, Lokio/PeekSource;->buffer:Lokio/Buffer; iget-object v6, v6, Lokio/Buffer;->head:Lokio/Segment; invoke-static {v6}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V iget v6, v6, Lokio/Segment;->pos:I if-ne v5, v6, :cond_2 :cond_1 move v3, v4 :cond_2 if-eqz v3, :cond_6 if-nez v2, :cond_3 return-wide v0 :cond_3 iget-object v0, p0, Lokio/PeekSource;->upstream:Lokio/BufferedSource; iget-wide v1, p0, Lokio/PeekSource;->pos:J const-wide/16 v3, 0x1 add-long/2addr v1, v3 .line 48 invoke-interface {v0, v1, v2}, Lokio/BufferedSource;->request(J)Z move-result v0 if-nez v0, :cond_4 const-wide/16 p0, -0x1 return-wide p0 :cond_4 iget-object v0, p0, Lokio/PeekSource;->expectedSegment:Lokio/Segment; if-nez v0, :cond_5 iget-object v0, p0, Lokio/PeekSource;->buffer:Lokio/Buffer; .line 50 iget-object v0, v0, Lokio/Buffer;->head:Lokio/Segment; if-eqz v0, :cond_5 iget-object v0, p0, Lokio/PeekSource;->buffer:Lokio/Buffer; .line 54 iget-object v0, v0, Lokio/Buffer;->head:Lokio/Segment; iput-object v0, p0, Lokio/PeekSource;->expectedSegment:Lokio/Segment; iget-object v0, p0, Lokio/PeekSource;->buffer:Lokio/Buffer; .line 55 iget-object v0, v0, Lokio/Buffer;->head:Lokio/Segment; invoke-static {v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V iget v0, v0, Lokio/Segment;->pos:I iput v0, p0, Lokio/PeekSource;->expectedPos:I :cond_5 iget-object v0, p0, Lokio/PeekSource;->buffer:Lokio/Buffer; .line 58 invoke-virtual {v0}, Lokio/Buffer;->size()J move-result-wide v0 iget-wide v2, p0, Lokio/PeekSource;->pos:J sub-long/2addr v0, v2 invoke-static {p2, p3, v0, v1}, Ljava/lang/Math;->min(JJ)J move-result-wide p2 iget-object v2, p0, Lokio/PeekSource;->buffer:Lokio/Buffer; iget-wide v4, p0, Lokio/PeekSource;->pos:J move-object v3, p1 move-wide v6, p2 .line 59 invoke-virtual/range {v2 .. v7}, Lokio/Buffer;->copyTo(Lokio/Buffer;JJ)Lokio/Buffer; iget-wide v0, p0, Lokio/PeekSource;->pos:J add-long/2addr v0, p2 iput-wide v0, p0, Lokio/PeekSource;->pos:J return-wide p2 .line 43 :cond_6 new-instance p0, Ljava/lang/IllegalStateException; const-string p1, "Peek source is invalid because upstream source was used" invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String; move-result-object p1 invoke-direct {p0, p1}, Ljava/lang/IllegalStateException;->(Ljava/lang/String;)V check-cast p0, Ljava/lang/Throwable; throw p0 .line 40 :cond_7 new-instance p0, Ljava/lang/IllegalStateException; const-string p1, "closed" invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String; move-result-object p1 invoke-direct {p0, p1}, Ljava/lang/IllegalStateException;->(Ljava/lang/String;)V check-cast p0, Ljava/lang/Throwable; throw p0 .line 39 :cond_8 new-instance p0, Ljava/lang/StringBuilder; const-string p1, "byteCount < 0: " invoke-direct {p0, p1}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V invoke-virtual {p0, p2, p3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder; move-result-object p0 invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object p0 new-instance p1, Ljava/lang/IllegalArgumentException; invoke-virtual {p0}, Ljava/lang/Object;->toString()Ljava/lang/String; move-result-object p0 invoke-direct {p1, p0}, Ljava/lang/IllegalArgumentException;->(Ljava/lang/String;)V check-cast p1, Ljava/lang/Throwable; throw p1 .end method .method public timeout()Lokio/Timeout; .locals 0 iget-object p0, p0, Lokio/PeekSource;->upstream:Lokio/BufferedSource; .line 65 invoke-interface {p0}, Lokio/BufferedSource;->timeout()Lokio/Timeout; move-result-object p0 return-object p0 .end method