Rabbit-R1/android (non root)/smali/smali_classes3/com/google/common/io/ByteStreams$LimitedInputStream.smali
2024-05-21 17:08:36 -04:00

318 lines
6.8 KiB
Smali

.class final Lcom/google/common/io/ByteStreams$LimitedInputStream;
.super Ljava/io/FilterInputStream;
.source "ByteStreams.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/google/common/io/ByteStreams;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x1a
name = "LimitedInputStream"
.end annotation
# instance fields
.field private left:J
.field private mark:J
# direct methods
.method constructor <init>(Ljava/io/InputStream;J)V
.locals 2
.line 712
invoke-direct {p0, p1}, Ljava/io/FilterInputStream;-><init>(Ljava/io/InputStream;)V
const-wide/16 v0, -0x1
iput-wide v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->mark:J
.line 713
invoke-static {p1}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
const-wide/16 v0, 0x0
cmp-long p1, p2, v0
if-ltz p1, :cond_0
const/4 p1, 0x1
goto :goto_0
:cond_0
const/4 p1, 0x0
:goto_0
const-string v0, "limit must be non-negative"
.line 714
invoke-static {p1, v0}, Lcom/google/common/base/Preconditions;->checkArgument(ZLjava/lang/Object;)V
iput-wide p2, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J
return-void
.end method
# virtual methods
.method public available()I
.locals 4
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 720
iget-object v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->in:Ljava/io/InputStream;
invoke-virtual {v0}, Ljava/io/InputStream;->available()I
move-result v0
int-to-long v0, v0
iget-wide v2, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J
invoke-static {v0, v1, v2, v3}, Ljava/lang/Math;->min(JJ)J
move-result-wide v0
long-to-int p0, v0
return p0
.end method
.method public declared-synchronized mark(I)V
.locals 2
monitor-enter p0
.line 726
:try_start_0
iget-object v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->in:Ljava/io/InputStream;
invoke-virtual {v0, p1}, Ljava/io/InputStream;->mark(I)V
iget-wide v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J
iput-wide v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->mark:J
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 728
monitor-exit p0
return-void
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method
.method public read()I
.locals 5
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
iget-wide v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
const/4 v1, -0x1
if-nez v0, :cond_0
return v1
.line 736
:cond_0
iget-object v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->in:Ljava/io/InputStream;
invoke-virtual {v0}, Ljava/io/InputStream;->read()I
move-result v0
if-eq v0, v1, :cond_1
iget-wide v1, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J
const-wide/16 v3, 0x1
sub-long/2addr v1, v3
iput-wide v1, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J
:cond_1
return v0
.end method
.method public read([BII)I
.locals 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
iget-wide v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J
const-wide/16 v2, 0x0
cmp-long v2, v0, v2
const/4 v3, -0x1
if-nez v2, :cond_0
return v3
:cond_0
int-to-long v4, p3
.line 749
invoke-static {v4, v5, v0, v1}, Ljava/lang/Math;->min(JJ)J
move-result-wide v0
long-to-int p3, v0
.line 750
iget-object v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->in:Ljava/io/InputStream;
invoke-virtual {v0, p1, p2, p3}, Ljava/io/InputStream;->read([BII)I
move-result p1
if-eq p1, v3, :cond_1
iget-wide p2, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J
int-to-long v0, p1
sub-long/2addr p2, v0
iput-wide p2, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J
:cond_1
return p1
.end method
.method public declared-synchronized reset()V
.locals 4
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
monitor-enter p0
.line 759
:try_start_0
iget-object v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->in:Ljava/io/InputStream;
invoke-virtual {v0}, Ljava/io/InputStream;->markSupported()Z
move-result v0
if-eqz v0, :cond_1
iget-wide v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->mark:J
const-wide/16 v2, -0x1
cmp-long v0, v0, v2
if-eqz v0, :cond_0
.line 766
iget-object v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->in:Ljava/io/InputStream;
invoke-virtual {v0}, Ljava/io/InputStream;->reset()V
iget-wide v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->mark:J
iput-wide v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 768
monitor-exit p0
return-void
.line 763
:cond_0
:try_start_1
new-instance v0, Ljava/io/IOException;
const-string v1, "Mark not set"
invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw v0
.line 760
:cond_1
new-instance v0, Ljava/io/IOException;
const-string v1, "Mark not supported"
invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw v0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public skip(J)J
.locals 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
iget-wide v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J
.line 772
invoke-static {p1, p2, v0, v1}, Ljava/lang/Math;->min(JJ)J
move-result-wide p1
.line 773
iget-object v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->in:Ljava/io/InputStream;
invoke-virtual {v0, p1, p2}, Ljava/io/InputStream;->skip(J)J
move-result-wide p1
iget-wide v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J
sub-long/2addr v0, p1
iput-wide v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J
return-wide p1
.end method