123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- .class final Lokio/Okio$1;
- .super Ljava/lang/Object;
- .source ""
- # interfaces
- .implements Lokio/Sink;
- # annotations
- .annotation system Ldalvik/annotation/EnclosingMethod;
- value = Lokio/Okio;->sink(Ljava/io/OutputStream;Lokio/Timeout;)Lokio/Sink;
- .end annotation
- .annotation system Ldalvik/annotation/InnerClass;
- accessFlags = 0x0
- name = null
- .end annotation
- # instance fields
- .field final synthetic val$out:Ljava/io/OutputStream;
- .field final synthetic val$timeout:Lokio/Timeout;
- # direct methods
- .method constructor <init>(Lokio/Timeout;Ljava/io/OutputStream;)V
- .locals 0
- iput-object p1, p0, Lokio/Okio$1;->val$timeout:Lokio/Timeout;
- iput-object p2, p0, Lokio/Okio$1;->val$out:Ljava/io/OutputStream;
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
- .end method
- # virtual methods
- .method public close()V
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget-object v0, p0, Lokio/Okio$1;->val$out:Ljava/io/OutputStream;
- invoke-virtual {v0}, Ljava/io/OutputStream;->close()V
- return-void
- .end method
- .method public flush()V
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget-object v0, p0, Lokio/Okio$1;->val$out:Ljava/io/OutputStream;
- invoke-virtual {v0}, Ljava/io/OutputStream;->flush()V
- return-void
- .end method
- .method public timeout()Lokio/Timeout;
- .locals 1
- iget-object v0, p0, Lokio/Okio$1;->val$timeout:Lokio/Timeout;
- return-object v0
- .end method
- .method public toString()Ljava/lang/String;
- .locals 2
- new-instance v0, Ljava/lang/StringBuilder;
- invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
- const-string v1, "sink("
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- iget-object v1, p0, Lokio/Okio$1;->val$out:Ljava/io/OutputStream;
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
- const-string v1, ")"
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object v0
- return-object v0
- .end method
- .method public write(Lokio/Buffer;J)V
- .locals 6
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget-wide v0, p1, Lokio/Buffer;->size:J
- const-wide/16 v2, 0x0
- move-wide v4, p2
- invoke-static/range {v0 .. v5}, Lokio/Util;->checkOffsetAndCount(JJJ)V
- :cond_0
- :goto_0
- const-wide/16 v0, 0x0
- cmp-long v2, p2, v0
- if-lez v2, :cond_1
- iget-object v0, p0, Lokio/Okio$1;->val$timeout:Lokio/Timeout;
- invoke-virtual {v0}, Lokio/Timeout;->throwIfReached()V
- iget-object v0, p1, Lokio/Buffer;->head:Lokio/Segment;
- iget v1, v0, Lokio/Segment;->limit:I
- iget v2, v0, Lokio/Segment;->pos:I
- sub-int/2addr v1, v2
- int-to-long v1, v1
- invoke-static {p2, p3, v1, v2}, Ljava/lang/Math;->min(JJ)J
- move-result-wide v1
- long-to-int v2, v1
- iget-object v1, p0, Lokio/Okio$1;->val$out:Ljava/io/OutputStream;
- iget-object v3, v0, Lokio/Segment;->data:[B
- iget v4, v0, Lokio/Segment;->pos:I
- invoke-virtual {v1, v3, v4, v2}, Ljava/io/OutputStream;->write([BII)V
- iget v1, v0, Lokio/Segment;->pos:I
- add-int/2addr v1, v2
- iput v1, v0, Lokio/Segment;->pos:I
- int-to-long v1, v2
- sub-long/2addr p2, v1
- iget-wide v3, p1, Lokio/Buffer;->size:J
- sub-long/2addr v3, v1
- iput-wide v3, p1, Lokio/Buffer;->size:J
- iget v1, v0, Lokio/Segment;->pos:I
- iget v2, v0, Lokio/Segment;->limit:I
- if-ne v1, v2, :cond_0
- invoke-virtual {v0}, Lokio/Segment;->pop()Lokio/Segment;
- move-result-object v1
- iput-object v1, p1, Lokio/Buffer;->head:Lokio/Segment;
- invoke-static {v0}, Lokio/SegmentPool;->recycle(Lokio/Segment;)V
- goto :goto_0
- :cond_1
- return-void
- .end method
|