.class final Lokhttp3/internal/http1/Http1Codec$FixedLengthSink; .super Ljava/lang/Object; .source "Http1Codec.java" # interfaces .implements Lokio/Sink; # annotations .annotation system Ldalvik/annotation/EnclosingClass; value = Lokhttp3/internal/http1/Http1Codec; .end annotation .annotation system Ldalvik/annotation/InnerClass; accessFlags = 0x12 name = "FixedLengthSink" .end annotation # instance fields .field private bytesRemaining:J .field private closed:Z .field final synthetic this$0:Lokhttp3/internal/http1/Http1Codec; .field private final timeout:Lokio/ForwardingTimeout; # direct methods .method constructor (Lokhttp3/internal/http1/Http1Codec;J)V .locals 1 .line 271 iput-object p1, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->this$0:Lokhttp3/internal/http1/Http1Codec; invoke-direct {p0}, Ljava/lang/Object;->()V .line 267 new-instance v0, Lokio/ForwardingTimeout; iget-object p1, p1, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink; invoke-interface {p1}, Lokio/BufferedSink;->timeout()Lokio/Timeout; move-result-object p1 invoke-direct {v0, p1}, Lokio/ForwardingTimeout;->(Lokio/Timeout;)V iput-object v0, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->timeout:Lokio/ForwardingTimeout; .line 272 iput-wide p2, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->bytesRemaining:J return-void .end method # virtual methods .method public close()V .locals 4 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation .line 296 iget-boolean v0, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->closed:Z if-eqz v0, :cond_0 return-void :cond_0 const/4 v0, 0x1 .line 297 iput-boolean v0, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->closed:Z .line 298 iget-wide v0, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->bytesRemaining:J const-wide/16 v2, 0x0 cmp-long v0, v0, v2 if-gtz v0, :cond_1 .line 299 iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->this$0:Lokhttp3/internal/http1/Http1Codec; iget-object v1, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->timeout:Lokio/ForwardingTimeout; invoke-virtual {v0, v1}, Lokhttp3/internal/http1/Http1Codec;->detachTimeout(Lokio/ForwardingTimeout;)V .line 300 iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->this$0:Lokhttp3/internal/http1/Http1Codec; const/4 v1, 0x3 iput v1, v0, Lokhttp3/internal/http1/Http1Codec;->state:I return-void .line 298 :cond_1 new-instance v0, Ljava/net/ProtocolException; const-string v1, "unexpected end of stream" invoke-direct {v0, v1}, Ljava/net/ProtocolException;->(Ljava/lang/String;)V throw v0 .end method .method public flush()V .locals 1 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation .line 291 iget-boolean v0, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->closed:Z if-eqz v0, :cond_0 return-void .line 292 :cond_0 iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->this$0:Lokhttp3/internal/http1/Http1Codec; iget-object v0, v0, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink; invoke-interface {v0}, Lokio/BufferedSink;->flush()V return-void .end method .method public timeout()Lokio/Timeout; .locals 1 .line 276 iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->timeout:Lokio/ForwardingTimeout; return-object v0 .end method .method public write(Lokio/Buffer;J)V .locals 7 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation .line 280 iget-boolean v0, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->closed:Z if-nez v0, :cond_1 .line 281 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}, Lokhttp3/internal/Util;->checkOffsetAndCount(JJJ)V .line 282 iget-wide v0, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->bytesRemaining:J cmp-long v0, p2, v0 if-gtz v0, :cond_0 .line 286 iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->this$0:Lokhttp3/internal/http1/Http1Codec; iget-object v0, v0, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink; invoke-interface {v0, p1, p2, p3}, Lokio/BufferedSink;->write(Lokio/Buffer;J)V .line 287 iget-wide v0, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->bytesRemaining:J sub-long/2addr v0, p2 iput-wide v0, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->bytesRemaining:J return-void .line 283 :cond_0 new-instance p1, Ljava/net/ProtocolException; new-instance v0, Ljava/lang/StringBuilder; invoke-direct {v0}, Ljava/lang/StringBuilder;->()V const-string v1, "expected " invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 iget-wide v1, p0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;->bytesRemaining:J invoke-virtual {v0, v1, v2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder; move-result-object v0 const-string v1, " bytes but received " invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-virtual {v0, p2, p3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder; move-result-object p2 invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object p2 invoke-direct {p1, p2}, Ljava/net/ProtocolException;->(Ljava/lang/String;)V throw p1 .line 280 :cond_1 new-instance p1, Ljava/lang/IllegalStateException; const-string p2, "closed" invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;->(Ljava/lang/String;)V throw p1 .end method