RopeByteString$RopeInputStream.smali
.class Lcom/google/protobuf/RopeByteString$RopeInputStream;
.super Ljava/io/InputStream;
.source "RopeByteString.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/google/protobuf/RopeByteString;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x2
name = "RopeInputStream"
.end annotation
# instance fields
.field private currentPiece:Lcom/google/protobuf/ByteString$LeafByteString;
.field private currentPieceIndex:I
.field private currentPieceOffsetInRope:I
.field private currentPieceSize:I
.field private mark:I
.field private pieceIterator:Lcom/google/protobuf/RopeByteString$PieceIterator;
.field final synthetic this$0:Lcom/google/protobuf/RopeByteString;
# direct methods
.method static constructor <clinit>()V
.registers 1
return-void
.end method
.method public constructor <init>(Lcom/google/protobuf/RopeByteString;)V
.registers 2
.line 772
iput-object p1, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->this$0:Lcom/google/protobuf/RopeByteString;
invoke-direct {p0}, Ljava/io/InputStream;-><init>()V
.line 773
invoke-direct {p0}, Lcom/google/protobuf/RopeByteString$RopeInputStream;->initialize()V
.line 774
return-void
.end method
.method private advanceIfCurrentPieceFullyRead()V
.registers 3
.line 881
iget-object v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPiece:Lcom/google/protobuf/ByteString$LeafByteString;
if-eqz v0, :cond_2e
iget v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceIndex:I
iget v1, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceSize:I
if-ne v0, v1, :cond_2e
.line 884
iget v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceOffsetInRope:I
add-int/2addr v0, v1
iput v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceOffsetInRope:I
.line 885
const/4 v0, 0x0
iput v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceIndex:I
.line 886
iget-object v1, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->pieceIterator:Lcom/google/protobuf/RopeByteString$PieceIterator;
invoke-virtual {v1}, Lcom/google/protobuf/RopeByteString$PieceIterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_29
.line 887
iget-object v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->pieceIterator:Lcom/google/protobuf/RopeByteString$PieceIterator;
invoke-virtual {v0}, Lcom/google/protobuf/RopeByteString$PieceIterator;->next()Lcom/google/protobuf/ByteString$LeafByteString;
move-result-object v0
iput-object v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPiece:Lcom/google/protobuf/ByteString$LeafByteString;
.line 888
invoke-virtual {v0}, Lcom/google/protobuf/ByteString$LeafByteString;->size()I
move-result v0
iput v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceSize:I
goto :goto_2e
.line 890
:cond_29
const/4 v1, 0x0
iput-object v1, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPiece:Lcom/google/protobuf/ByteString$LeafByteString;
.line 891
iput v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceSize:I
.line 894
:cond_2e
:goto_2e
return-void
.end method
.method private initialize()V
.registers 4
.line 868
new-instance v0, Lcom/google/protobuf/RopeByteString$PieceIterator;
iget-object v1, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->this$0:Lcom/google/protobuf/RopeByteString;
const/4 v2, 0x0
invoke-direct {v0, v1, v2}, Lcom/google/protobuf/RopeByteString$PieceIterator;-><init>(Lcom/google/protobuf/ByteString;Lcom/google/protobuf/RopeByteString$1;)V
iput-object v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->pieceIterator:Lcom/google/protobuf/RopeByteString$PieceIterator;
.line 869
invoke-virtual {v0}, Lcom/google/protobuf/RopeByteString$PieceIterator;->next()Lcom/google/protobuf/ByteString$LeafByteString;
move-result-object v0
iput-object v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPiece:Lcom/google/protobuf/ByteString$LeafByteString;
.line 870
invoke-virtual {v0}, Lcom/google/protobuf/ByteString$LeafByteString;->size()I
move-result v0
iput v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceSize:I
.line 871
const/4 v0, 0x0
iput v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceIndex:I
.line 872
iput v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceOffsetInRope:I
.line 873
return-void
.end method
.method private readSkipInternal([BII)I
.registers 9
.param p1, "b" # [B
.param p2, "offset" # I
.param p3, "length" # I
.line 807
move v0, p3
.line 808
.local v0, "bytesRemaining":I
:goto_1
if-lez v0, :cond_28
.line 809
invoke-direct {p0}, Lcom/google/protobuf/RopeByteString$RopeInputStream;->advanceIfCurrentPieceFullyRead()V
.line 810
iget-object v1, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPiece:Lcom/google/protobuf/ByteString$LeafByteString;
if-nez v1, :cond_e
.line 811
if-ne v0, p3, :cond_28
.line 813
const/4 v1, -0x1
return v1
.line 818
:cond_e
iget v1, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceSize:I
iget v2, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceIndex:I
sub-int/2addr v1, v2
.line 819
.local v1, "currentPieceRemaining":I
invoke-static {v1, v0}, Ljava/lang/Math;->min(II)I
move-result v2
.line 820
.local v2, "count":I
if-eqz p1, :cond_21
.line 821
iget-object v3, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPiece:Lcom/google/protobuf/ByteString$LeafByteString;
iget v4, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceIndex:I
invoke-virtual {v3, p1, v4, p2, v2}, Lcom/google/protobuf/ByteString$LeafByteString;->copyTo([BIII)V
.line 822
add-int/2addr p2, v2
.line 824
:cond_21
iget v3, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceIndex:I
add-int/2addr v3, v2
iput v3, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceIndex:I
.line 825
sub-int/2addr v0, v2
.line 826
.end local v1 # "currentPieceRemaining":I
.end local v2 # "count":I
goto :goto_1
.line 829
:cond_28
sub-int v1, p3, v0
return v1
.end method
# virtual methods
.method public available()I
.registers 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 844
iget v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceOffsetInRope:I
iget v1, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceIndex:I
add-int/2addr v0, v1
.line 845
.local v0, "bytesRead":I
iget-object v1, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->this$0:Lcom/google/protobuf/RopeByteString;
invoke-virtual {v1}, Lcom/google/protobuf/RopeByteString;->size()I
move-result v1
sub-int/2addr v1, v0
return v1
.end method
.method public mark(I)V
.registers 4
.param p1, "readAheadLimit" # I
.line 856
iget v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceOffsetInRope:I
iget v1, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceIndex:I
add-int/2addr v0, v1
iput v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->mark:I
.line 857
return-void
.end method
.method public markSupported()Z
.registers 2
.line 850
const/4 v0, 0x1
return v0
.end method
.method public read()I
.registers 4
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 834
invoke-direct {p0}, Lcom/google/protobuf/RopeByteString$RopeInputStream;->advanceIfCurrentPieceFullyRead()V
.line 835
iget-object v0, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPiece:Lcom/google/protobuf/ByteString$LeafByteString;
if-nez v0, :cond_9
.line 836
const/4 v0, -0x1
return v0
.line 838
:cond_9
iget v1, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceIndex:I
add-int/lit8 v2, v1, 0x1
iput v2, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->currentPieceIndex:I
invoke-virtual {v0, v1}, Lcom/google/protobuf/ByteString$LeafByteString;->byteAt(I)B
move-result v0
and-int/lit16 v0, v0, 0xff
return v0
.end method
.method public read([BII)I
.registers 5
.param p1, "b" # [B
.param p2, "offset" # I
.param p3, "length" # I
.line 778
if-eqz p1, :cond_15
.line 780
if-ltz p2, :cond_f
if-ltz p3, :cond_f
array-length v0, p1
sub-int/2addr v0, p2
if-gt p3, v0, :cond_f
.line 783
invoke-direct {p0, p1, p2, p3}, Lcom/google/protobuf/RopeByteString$RopeInputStream;->readSkipInternal([BII)I
move-result v0
return v0
.line 781
:cond_f
new-instance v0, Ljava/lang/IndexOutOfBoundsException;
invoke-direct {v0}, Ljava/lang/IndexOutOfBoundsException;-><init>()V
throw v0
.line 779
:cond_15
const/4 v0, 0x0
throw v0
.end method
.method public declared-synchronized reset()V
.registers 4
monitor-enter p0
.line 862
:try_start_1
invoke-direct {p0}, Lcom/google/protobuf/RopeByteString$RopeInputStream;->initialize()V
.line 863
const/4 v0, 0x0
const/4 v1, 0x0
iget v2, p0, Lcom/google/protobuf/RopeByteString$RopeInputStream;->mark:I
invoke-direct {p0, v0, v1, v2}, Lcom/google/protobuf/RopeByteString$RopeInputStream;->readSkipInternal([BII)I
:try_end_b
.catchall {:try_start_1 .. :try_end_b} :catchall_d
.line 864
monitor-exit p0
return-void
.line 861
.end local p0 # "this":Lcom/google/protobuf/RopeByteString$RopeInputStream;
:catchall_d
move-exception v0
monitor-exit p0
throw v0
.end method
.method public skip(J)J
.registers 6
.param p1, "length" # J
.line 788
const-wide/16 v0, 0x0
cmp-long v2, p1, v0
if-ltz v2, :cond_19
.line 790
const-wide/32 v0, 0x7fffffff
cmp-long v2, p1, v0
if-lez v2, :cond_10
.line 791
const-wide/32 p1, 0x7fffffff
.line 793
:cond_10
const/4 v0, 0x0
const/4 v1, 0x0
long-to-int v2, p1
invoke-direct {p0, v0, v1, v2}, Lcom/google/protobuf/RopeByteString$RopeInputStream;->readSkipInternal([BII)I
move-result v0
int-to-long v0, v0
return-wide v0
.line 789
:cond_19
new-instance v0, Ljava/lang/IndexOutOfBoundsException;
invoke-direct {v0}, Ljava/lang/IndexOutOfBoundsException;-><init>()V
throw v0
.end method