.class public Lorg/apache/http/entity/InputStreamEntity; .super Lorg/apache/http/entity/AbstractHttpEntity; .source "InputStreamEntity.java" # static fields .field private static final BUFFER_SIZE:I = 0x800 # instance fields .field private consumed:Z .field private final content:Ljava/io/InputStream; .field private final length:J # direct methods .method public constructor (Ljava/io/InputStream;J)V .locals 1 .line 1 invoke-direct {p0}, Lorg/apache/http/entity/AbstractHttpEntity;->()V const/4 v0, 0x0 .line 2 iput-boolean v0, p0, Lorg/apache/http/entity/InputStreamEntity;->consumed:Z if-eqz p1, :cond_0 .line 3 iput-object p1, p0, Lorg/apache/http/entity/InputStreamEntity;->content:Ljava/io/InputStream; .line 4 iput-wide p2, p0, Lorg/apache/http/entity/InputStreamEntity;->length:J return-void .line 5 :cond_0 new-instance p1, Ljava/lang/IllegalArgumentException; const-string p2, "Source input stream may not be null" invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;->(Ljava/lang/String;)V throw p1 .end method # virtual methods .method public consumeContent()V .locals 1 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation const/4 v0, 0x1 .line 1 iput-boolean v0, p0, Lorg/apache/http/entity/InputStreamEntity;->consumed:Z .line 2 iget-object v0, p0, Lorg/apache/http/entity/InputStreamEntity;->content:Ljava/io/InputStream; invoke-virtual {v0}, Ljava/io/InputStream;->close()V return-void .end method .method public getContent()Ljava/io/InputStream; .locals 1 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation .line 1 iget-object v0, p0, Lorg/apache/http/entity/InputStreamEntity;->content:Ljava/io/InputStream; return-object v0 .end method .method public getContentLength()J .locals 2 .line 1 iget-wide v0, p0, Lorg/apache/http/entity/InputStreamEntity;->length:J return-wide v0 .end method .method public isRepeatable()Z .locals 1 const/4 v0, 0x0 return v0 .end method .method public isStreaming()Z .locals 1 .line 1 iget-boolean v0, p0, Lorg/apache/http/entity/InputStreamEntity;->consumed:Z xor-int/lit8 v0, v0, 0x1 return v0 .end method .method public writeTo(Ljava/io/OutputStream;)V .locals 11 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation if-eqz p1, :cond_3 .line 1 iget-object v0, p0, Lorg/apache/http/entity/InputStreamEntity;->content:Ljava/io/InputStream; const/16 v1, 0x800 new-array v1, v1, [B .line 2 iget-wide v2, p0, Lorg/apache/http/entity/InputStreamEntity;->length:J const-wide/16 v4, 0x0 cmp-long v6, v2, v4 const/4 v7, -0x1 const/4 v8, 0x0 if-gez v6, :cond_0 .line 3 :goto_0 invoke-virtual {v0, v1}, Ljava/io/InputStream;->read([B)I move-result v2 if-eq v2, v7, :cond_2 .line 4 invoke-virtual {p1, v1, v8, v2}, Ljava/io/OutputStream;->write([BII)V goto :goto_0 :cond_0 :goto_1 cmp-long v6, v2, v4 if-lez v6, :cond_2 const-wide/16 v9, 0x800 .line 5 invoke-static {v9, v10, v2, v3}, Ljava/lang/Math;->min(JJ)J move-result-wide v9 long-to-int v6, v9 invoke-virtual {v0, v1, v8, v6}, Ljava/io/InputStream;->read([BII)I move-result v6 if-ne v6, v7, :cond_1 goto :goto_2 .line 6 :cond_1 invoke-virtual {p1, v1, v8, v6}, Ljava/io/OutputStream;->write([BII)V int-to-long v9, v6 sub-long/2addr v2, v9 goto :goto_1 :cond_2 :goto_2 const/4 p1, 0x1 .line 7 iput-boolean p1, p0, Lorg/apache/http/entity/InputStreamEntity;->consumed:Z return-void .line 8 :cond_3 new-instance p1, Ljava/lang/IllegalArgumentException; const-string v0, "Output stream may not be null" invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;->(Ljava/lang/String;)V throw p1 .end method