.class public Lcom/ea/nimble/ByteBufferIOStream$ByteBufferOutputStream; .super Ljava/io/OutputStream; .source "SourceFile" # annotations .annotation system Ldalvik/annotation/EnclosingClass; value = Lcom/ea/nimble/ByteBufferIOStream; .end annotation .annotation system Ldalvik/annotation/InnerClass; accessFlags = 0x1 name = "ByteBufferOutputStream" .end annotation # instance fields .field final synthetic this$0:Lcom/ea/nimble/ByteBufferIOStream; # direct methods .method public constructor (Lcom/ea/nimble/ByteBufferIOStream;)V .locals 0 iput-object p1, p0, Lcom/ea/nimble/ByteBufferIOStream$ByteBufferOutputStream;->this$0:Lcom/ea/nimble/ByteBufferIOStream; .line 280 invoke-direct {p0}, Ljava/io/OutputStream;->()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, Lcom/ea/nimble/ByteBufferIOStream$ByteBufferOutputStream;->this$0:Lcom/ea/nimble/ByteBufferIOStream; .line 286 invoke-virtual {v0}, Lcom/ea/nimble/ByteBufferIOStream;->closeIOStream()V return-void .end method .method public write(I)V .locals 3 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation iget-object v0, p0, Lcom/ea/nimble/ByteBufferIOStream$ByteBufferOutputStream;->this$0:Lcom/ea/nimble/ByteBufferIOStream; .line 358 iget-boolean v1, v0, Lcom/ea/nimble/ByteBufferIOStream;->m_closed:Z if-nez v1, :cond_1 .line 362 iget-object v0, v0, Lcom/ea/nimble/ByteBufferIOStream;->m_buffer:Ljava/util/LinkedList; invoke-virtual {v0}, Ljava/util/LinkedList;->getFirst()Ljava/lang/Object; move-result-object v0 check-cast v0, [B iget-object v1, p0, Lcom/ea/nimble/ByteBufferIOStream$ByteBufferOutputStream;->this$0:Lcom/ea/nimble/ByteBufferIOStream; iget v2, v1, Lcom/ea/nimble/ByteBufferIOStream;->m_writePosition:I int-to-byte p1, p1 aput-byte p1, v0, v2 add-int/lit8 v2, v2, 0x1 .line 363 iput v2, v1, Lcom/ea/nimble/ByteBufferIOStream;->m_writePosition:I const/16 p1, 0x1000 if-ne v2, p1, :cond_0 const/4 p1, 0x0 .line 366 iput p1, v1, Lcom/ea/nimble/ByteBufferIOStream;->m_writePosition:I .line 367 iget p1, v1, Lcom/ea/nimble/ByteBufferIOStream;->m_availableSegment:I add-int/lit8 p1, p1, 0x1 iput p1, v1, Lcom/ea/nimble/ByteBufferIOStream;->m_availableSegment:I :cond_0 return-void .line 360 :cond_1 new-instance p1, Ljava/io/IOException; const-string v0, "ByteBufferIOStream is closed" invoke-direct {p1, v0}, Ljava/io/IOException;->(Ljava/lang/String;)V throw p1 .end method .method public write([B)V .locals 2 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation .line 352 array-length v0, p1 const/4 v1, 0x0 invoke-virtual {p0, p1, v1, v0}, Lcom/ea/nimble/ByteBufferIOStream$ByteBufferOutputStream;->write([BII)V return-void .end method .method public write([BII)V .locals 6 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation if-ltz p2, :cond_6 if-ltz p3, :cond_6 add-int v0, p2, p3 .line 292 array-length v1, p1 if-gt v0, v1, :cond_6 iget-object v0, p0, Lcom/ea/nimble/ByteBufferIOStream$ByteBufferOutputStream;->this$0:Lcom/ea/nimble/ByteBufferIOStream; .line 297 iget-boolean v1, v0, Lcom/ea/nimble/ByteBufferIOStream;->m_closed:Z if-nez v1, :cond_5 .line 302 iget v1, v0, Lcom/ea/nimble/ByteBufferIOStream;->m_writePosition:I const/16 v2, 0x1000 rsub-int v1, v1, 0x1000 .line 303 iget-object v0, v0, Lcom/ea/nimble/ByteBufferIOStream;->m_buffer:Ljava/util/LinkedList; invoke-virtual {v0}, Ljava/util/AbstractCollection;->iterator()Ljava/util/Iterator; move-result-object v0 const/4 v3, 0x0 move v4, v3 :goto_0 iget-object v5, p0, Lcom/ea/nimble/ByteBufferIOStream$ByteBufferOutputStream;->this$0:Lcom/ea/nimble/ByteBufferIOStream; .line 304 iget v5, v5, Lcom/ea/nimble/ByteBufferIOStream;->m_availableSegment:I if-ge v4, v5, :cond_0 .line 306 invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object; add-int/lit8 v4, v4, 0x1 goto :goto_0 :cond_0 if-ge p3, v1, :cond_1 .line 311 invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v0 iget-object v1, p0, Lcom/ea/nimble/ByteBufferIOStream$ByteBufferOutputStream;->this$0:Lcom/ea/nimble/ByteBufferIOStream; iget v1, v1, Lcom/ea/nimble/ByteBufferIOStream;->m_writePosition:I invoke-static {p1, p2, v0, v1, p3}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V iget-object p1, p0, Lcom/ea/nimble/ByteBufferIOStream$ByteBufferOutputStream;->this$0:Lcom/ea/nimble/ByteBufferIOStream; .line 312 iget p2, p1, Lcom/ea/nimble/ByteBufferIOStream;->m_writePosition:I add-int/2addr p2, p3 iput p2, p1, Lcom/ea/nimble/ByteBufferIOStream;->m_writePosition:I return-void .line 316 :cond_1 invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v4 iget-object v5, p0, Lcom/ea/nimble/ByteBufferIOStream$ByteBufferOutputStream;->this$0:Lcom/ea/nimble/ByteBufferIOStream; iget v5, v5, Lcom/ea/nimble/ByteBufferIOStream;->m_writePosition:I invoke-static {p1, p2, v4, v5, v1}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V sub-int/2addr p3, v1 add-int/2addr p2, v1 iget-object v1, p0, Lcom/ea/nimble/ByteBufferIOStream$ByteBufferOutputStream;->this$0:Lcom/ea/nimble/ByteBufferIOStream; .line 319 iget v4, v1, Lcom/ea/nimble/ByteBufferIOStream;->m_availableSegment:I add-int/lit8 v4, v4, 0x1 iput v4, v1, Lcom/ea/nimble/ByteBufferIOStream;->m_availableSegment:I .line 320 iput v3, v1, Lcom/ea/nimble/ByteBufferIOStream;->m_writePosition:I :goto_1 if-lez p3, :cond_4 .line 324 invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z move-result v1 if-eqz v1, :cond_2 .line 326 invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v1 check-cast v1, [B goto :goto_2 :cond_2 new-array v1, v2, [B iget-object v4, p0, Lcom/ea/nimble/ByteBufferIOStream$ByteBufferOutputStream;->this$0:Lcom/ea/nimble/ByteBufferIOStream; .line 331 iget-object v4, v4, Lcom/ea/nimble/ByteBufferIOStream;->m_buffer:Ljava/util/LinkedList; invoke-virtual {v4, v1}, Ljava/util/LinkedList;->add(Ljava/lang/Object;)Z :goto_2 if-ge p3, v2, :cond_3 .line 336 invoke-static {p1, p2, v1, v3, p3}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V iget-object v1, p0, Lcom/ea/nimble/ByteBufferIOStream$ByteBufferOutputStream;->this$0:Lcom/ea/nimble/ByteBufferIOStream; .line 337 iput p3, v1, Lcom/ea/nimble/ByteBufferIOStream;->m_writePosition:I move p3, v3 goto :goto_1 .line 342 :cond_3 invoke-static {p1, p2, v1, v3, v2}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V add-int/lit16 p3, p3, -0x1000 add-int/lit16 p2, p2, 0x1000 iget-object v1, p0, Lcom/ea/nimble/ByteBufferIOStream$ByteBufferOutputStream;->this$0:Lcom/ea/nimble/ByteBufferIOStream; .line 345 iget v4, v1, Lcom/ea/nimble/ByteBufferIOStream;->m_availableSegment:I add-int/lit8 v4, v4, 0x1 iput v4, v1, Lcom/ea/nimble/ByteBufferIOStream;->m_availableSegment:I goto :goto_1 :cond_4 return-void .line 299 :cond_5 new-instance p1, Ljava/io/IOException; const-string p2, "ByteBufferIOStream is closed" invoke-direct {p1, p2}, Ljava/io/IOException;->(Ljava/lang/String;)V throw p1 .line 294 :cond_6 new-instance p1, Ljava/lang/IndexOutOfBoundsException; const-string p2, "The writing range is out of buffer boundary." invoke-direct {p1, p2}, Ljava/lang/IndexOutOfBoundsException;->(Ljava/lang/String;)V throw p1 .end method