.class public final Lokio/DeflaterSink; .super Ljava/lang/Object; .source "DeflaterSink.kt" # interfaces .implements Lokio/Sink; # annotations .annotation system Ldalvik/annotation/SourceDebugExtension; value = "SMAP\nDeflaterSink.kt\nKotlin\n*S Kotlin\n*F\n+ 1 DeflaterSink.kt\nokio/DeflaterSink\n+ 2 -Util.kt\nokio/-Util\n*L\n1#1,162:1\n75#2:163\n*E\n*S KotlinDebug\n*F\n+ 1 DeflaterSink.kt\nokio/DeflaterSink\n*L\n60#1:163\n*E\n" .end annotation .annotation runtime Lkotlin/Metadata; bv = { 0x1, 0x0, 0x3 } d1 = { "\u0000B\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0002\n\u0002\u0008\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\u0018\u00002\u00020\u0001B\u0017\u0008\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0001\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u00a2\u0006\u0002\u0010\u0005B\u0017\u0008\u0000\u0012\u0006\u0010\u0002\u001a\u00020\u0006\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u00a2\u0006\u0002\u0010\u0007J\u0008\u0010\n\u001a\u00020\u000bH\u0016J\u0010\u0010\u000c\u001a\u00020\u000b2\u0006\u0010\r\u001a\u00020\tH\u0003J\r\u0010\u000e\u001a\u00020\u000bH\u0000\u00a2\u0006\u0002\u0008\u000fJ\u0008\u0010\u0010\u001a\u00020\u000bH\u0016J\u0008\u0010\u0011\u001a\u00020\u0012H\u0016J\u0008\u0010\u0013\u001a\u00020\u0014H\u0016J\u0018\u0010\u0015\u001a\u00020\u000b2\u0006\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u0018\u001a\u00020\u0019H\u0016R\u000e\u0010\u0008\u001a\u00020\tX\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0006X\u0082\u0004\u00a2\u0006\u0002\n\u0000\u00a8\u0006\u001a" } d2 = { "Lokio/DeflaterSink;", "Lokio/Sink;", "sink", "deflater", "Ljava/util/zip/Deflater;", "(Lokio/Sink;Ljava/util/zip/Deflater;)V", "Lokio/BufferedSink;", "(Lokio/BufferedSink;Ljava/util/zip/Deflater;)V", "closed", "", "close", "", "deflate", "syncFlush", "finishDeflate", "finishDeflate$okio", "flush", "timeout", "Lokio/Timeout;", "toString", "", "write", "source", "Lokio/Buffer;", "byteCount", "", "okio" } k = 0x1 mv = { 0x1, 0x4, 0x0 } .end annotation # instance fields .field private closed:Z .field private final deflater:Ljava/util/zip/Deflater; .field private final sink:Lokio/BufferedSink; # direct methods .method public constructor (Lokio/BufferedSink;Ljava/util/zip/Deflater;)V .locals 1 const-string v0, "sink" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const-string v0, "deflater" invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 47 invoke-direct {p0}, Ljava/lang/Object;->()V iput-object p1, p0, Lokio/DeflaterSink;->sink:Lokio/BufferedSink; iput-object p2, p0, Lokio/DeflaterSink;->deflater:Ljava/util/zip/Deflater; return-void .end method .method public constructor (Lokio/Sink;Ljava/util/zip/Deflater;)V .locals 1 const-string v0, "sink" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const-string v0, "deflater" invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 48 invoke-static {p1}, Lokio/Okio;->buffer(Lokio/Sink;)Lokio/BufferedSink; move-result-object p1 invoke-direct {p0, p1, p2}, Lokio/DeflaterSink;->(Lokio/BufferedSink;Ljava/util/zip/Deflater;)V return-void .end method .method private final deflate(Z)V .locals 7 iget-object v0, p0, Lokio/DeflaterSink;->sink:Lokio/BufferedSink; .line 80 invoke-interface {v0}, Lokio/BufferedSink;->getBuffer()Lokio/Buffer; move-result-object v0 :cond_0 :goto_0 const/4 v1, 0x1 .line 82 invoke-virtual {v0, v1}, Lokio/Buffer;->writableSegment$okio(I)Lokio/Segment; move-result-object v1 if-eqz p1, :cond_1 iget-object v2, p0, Lokio/DeflaterSink;->deflater:Ljava/util/zip/Deflater; .line 89 iget-object v3, v1, Lokio/Segment;->data:[B iget v4, v1, Lokio/Segment;->limit:I iget v5, v1, Lokio/Segment;->limit:I rsub-int v5, v5, 0x2000 const/4 v6, 0x2 invoke-virtual {v2, v3, v4, v5, v6}, Ljava/util/zip/Deflater;->deflate([BIII)I move-result v2 goto :goto_1 :cond_1 iget-object v2, p0, Lokio/DeflaterSink;->deflater:Ljava/util/zip/Deflater; .line 91 iget-object v3, v1, Lokio/Segment;->data:[B iget v4, v1, Lokio/Segment;->limit:I iget v5, v1, Lokio/Segment;->limit:I rsub-int v5, v5, 0x2000 invoke-virtual {v2, v3, v4, v5}, Ljava/util/zip/Deflater;->deflate([BII)I move-result v2 :goto_1 if-lez v2, :cond_2 .line 95 iget v3, v1, Lokio/Segment;->limit:I add-int/2addr v3, v2 iput v3, v1, Lokio/Segment;->limit:I .line 96 invoke-virtual {v0}, Lokio/Buffer;->size()J move-result-wide v3 int-to-long v1, v2 add-long/2addr v3, v1 invoke-virtual {v0, v3, v4}, Lokio/Buffer;->setSize$okio(J)V iget-object v1, p0, Lokio/DeflaterSink;->sink:Lokio/BufferedSink; .line 97 invoke-interface {v1}, Lokio/BufferedSink;->emitCompleteSegments()Lokio/BufferedSink; goto :goto_0 :cond_2 iget-object v2, p0, Lokio/DeflaterSink;->deflater:Ljava/util/zip/Deflater; .line 98 invoke-virtual {v2}, Ljava/util/zip/Deflater;->needsInput()Z move-result v2 if-eqz v2, :cond_0 .line 99 iget p0, v1, Lokio/Segment;->pos:I iget p1, v1, Lokio/Segment;->limit:I if-ne p0, p1, :cond_3 .line 101 invoke-virtual {v1}, Lokio/Segment;->pop()Lokio/Segment; move-result-object p0 iput-object p0, v0, Lokio/Buffer;->head:Lokio/Segment; .line 102 invoke-static {v1}, Lokio/SegmentPool;->recycle(Lokio/Segment;)V :cond_3 return-void .end method # virtual methods .method public close()V .locals 2 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation iget-boolean v0, p0, Lokio/DeflaterSink;->closed:Z if-eqz v0, :cond_0 return-void :cond_0 const/4 v0, 0x0 .line 126 move-object v1, v0 check-cast v1, Ljava/lang/Throwable; .line 128 :try_start_0 invoke-virtual {p0}, Lokio/DeflaterSink;->finishDeflate$okio()V :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 goto :goto_0 :catchall_0 move-exception v0 :goto_0 :try_start_1 iget-object v1, p0, Lokio/DeflaterSink;->deflater:Ljava/util/zip/Deflater; .line 134 invoke-virtual {v1}, Ljava/util/zip/Deflater;->end()V :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_1 goto :goto_1 :catchall_1 move-exception v1 if-nez v0, :cond_1 move-object v0, v1 :cond_1 :goto_1 :try_start_2 iget-object v1, p0, Lokio/DeflaterSink;->sink:Lokio/BufferedSink; .line 140 invoke-interface {v1}, Lokio/BufferedSink;->close()V :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_2 goto :goto_2 :catchall_2 move-exception v1 if-nez v0, :cond_2 move-object v0, v1 :cond_2 :goto_2 const/4 v1, 0x1 iput-boolean v1, p0, Lokio/DeflaterSink;->closed:Z if-nez v0, :cond_3 return-void .line 147 :cond_3 throw v0 .end method .method public final finishDeflate$okio()V .locals 1 iget-object v0, p0, Lokio/DeflaterSink;->deflater:Ljava/util/zip/Deflater; .line 116 invoke-virtual {v0}, Ljava/util/zip/Deflater;->finish()V const/4 v0, 0x0 .line 117 invoke-direct {p0, v0}, Lokio/DeflaterSink;->deflate(Z)V return-void .end method .method public flush()V .locals 1 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation const/4 v0, 0x1 .line 111 invoke-direct {p0, v0}, Lokio/DeflaterSink;->deflate(Z)V iget-object p0, p0, Lokio/DeflaterSink;->sink:Lokio/BufferedSink; .line 112 invoke-interface {p0}, Lokio/BufferedSink;->flush()V return-void .end method .method public timeout()Lokio/Timeout; .locals 0 iget-object p0, p0, Lokio/DeflaterSink;->sink:Lokio/BufferedSink; .line 150 invoke-interface {p0}, Lokio/BufferedSink;->timeout()Lokio/Timeout; move-result-object p0 return-object p0 .end method .method public toString()Ljava/lang/String; .locals 2 .line 152 new-instance v0, Ljava/lang/StringBuilder; const-string v1, "DeflaterSink(" invoke-direct {v0, v1}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V iget-object p0, p0, Lokio/DeflaterSink;->sink:Lokio/BufferedSink; invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object p0 const/16 v0, 0x29 invoke-virtual {p0, v0}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder; move-result-object p0 invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object p0 return-object p0 .end method .method public write(Lokio/Buffer;J)V .locals 7 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation const-string v0, "source" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 54 invoke-virtual {p1}, Lokio/Buffer;->size()J move-result-wide v1 const-wide/16 v3, 0x0 move-wide v5, p2 invoke-static/range {v1 .. v6}, Lokio/-Util;->checkOffsetAndCount(JJJ)V :goto_0 const-wide/16 v0, 0x0 cmp-long v0, p2, v0 if-lez v0, :cond_1 .line 59 iget-object v0, p1, Lokio/Buffer;->head:Lokio/Segment; invoke-static {v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V .line 60 iget v1, v0, Lokio/Segment;->limit:I iget v2, v0, Lokio/Segment;->pos:I sub-int/2addr v1, v2 int-to-long v1, v1 .line 163 invoke-static {p2, p3, v1, v2}, Ljava/lang/Math;->min(JJ)J move-result-wide v1 long-to-int v1, v1 iget-object v2, p0, Lokio/DeflaterSink;->deflater:Ljava/util/zip/Deflater; .line 61 iget-object v3, v0, Lokio/Segment;->data:[B iget v4, v0, Lokio/Segment;->pos:I invoke-virtual {v2, v3, v4, v1}, Ljava/util/zip/Deflater;->setInput([BII)V const/4 v2, 0x0 .line 64 invoke-direct {p0, v2}, Lokio/DeflaterSink;->deflate(Z)V .line 67 invoke-virtual {p1}, Lokio/Buffer;->size()J move-result-wide v2 int-to-long v4, v1 sub-long/2addr v2, v4 invoke-virtual {p1, v2, v3}, Lokio/Buffer;->setSize$okio(J)V .line 68 iget v2, v0, Lokio/Segment;->pos:I add-int/2addr v2, v1 iput v2, v0, Lokio/Segment;->pos:I .line 69 iget v1, v0, Lokio/Segment;->pos:I iget v2, v0, Lokio/Segment;->limit:I if-ne v1, v2, :cond_0 .line 70 invoke-virtual {v0}, Lokio/Segment;->pop()Lokio/Segment; move-result-object v1 iput-object v1, p1, Lokio/Buffer;->head:Lokio/Segment; .line 71 invoke-static {v0}, Lokio/SegmentPool;->recycle(Lokio/Segment;)V :cond_0 sub-long/2addr p2, v4 goto :goto_0 :cond_1 return-void .end method