You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
329 lines
6.7 KiB
329 lines
6.7 KiB
.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 |
|
|
|
.prologue |
|
.line 674 |
|
invoke-direct {p0, p1}, Ljava/io/FilterInputStream;-><init>(Ljava/io/InputStream;)V |
|
|
|
.line 671 |
|
const-wide/16 v0, -0x1 |
|
|
|
iput-wide v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->mark:J |
|
|
|
.line 675 |
|
invoke-static {p1}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object; |
|
|
|
.line 676 |
|
const-wide/16 v0, 0x0 |
|
|
|
cmp-long v0, p2, v0 |
|
|
|
if-ltz v0, :cond_0 |
|
|
|
const/4 v0, 0x1 |
|
|
|
:goto_0 |
|
const-string v1, "limit must be non-negative" |
|
|
|
invoke-static {v0, v1}, Lcom/google/common/base/Preconditions;->checkArgument(ZLjava/lang/Object;)V |
|
|
|
.line 677 |
|
iput-wide p2, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J |
|
|
|
.line 678 |
|
return-void |
|
|
|
.line 676 |
|
:cond_0 |
|
const/4 v0, 0x0 |
|
|
|
goto :goto_0 |
|
.end method |
|
|
|
|
|
# virtual methods |
|
.method public available()I |
|
.locals 4 |
|
|
|
.prologue |
|
.line 681 |
|
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 v0, v0 |
|
|
|
return v0 |
|
.end method |
|
|
|
.method public declared-synchronized mark(I)V |
|
.locals 2 |
|
|
|
.prologue |
|
.line 686 |
|
monitor-enter p0 |
|
|
|
: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 |
|
|
|
.line 687 |
|
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 688 |
|
monitor-exit p0 |
|
|
|
return-void |
|
|
|
.line 686 |
|
:catchall_0 |
|
move-exception v0 |
|
|
|
monitor-exit p0 |
|
|
|
throw v0 |
|
.end method |
|
|
|
.method public read()I |
|
.locals 6 |
|
|
|
.prologue |
|
const/4 v0, -0x1 |
|
|
|
.line 691 |
|
iget-wide v2, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J |
|
|
|
const-wide/16 v4, 0x0 |
|
|
|
cmp-long v1, v2, v4 |
|
|
|
if-nez v1, :cond_0 |
|
|
|
.line 699 |
|
:goto_0 |
|
return v0 |
|
|
|
.line 695 |
|
:cond_0 |
|
iget-object v1, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->in:Ljava/io/InputStream; |
|
|
|
invoke-virtual {v1}, Ljava/io/InputStream;->read()I |
|
|
|
move-result v1 |
|
|
|
.line 696 |
|
if-eq v1, v0, :cond_1 |
|
|
|
.line 697 |
|
iget-wide v2, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J |
|
|
|
const-wide/16 v4, 0x1 |
|
|
|
sub-long/2addr v2, v4 |
|
|
|
iput-wide v2, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J |
|
|
|
:cond_1 |
|
move v0, v1 |
|
|
|
.line 699 |
|
goto :goto_0 |
|
.end method |
|
|
|
.method public read([BII)I |
|
.locals 6 |
|
|
|
.prologue |
|
const/4 v0, -0x1 |
|
|
|
.line 703 |
|
iget-wide v2, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J |
|
|
|
const-wide/16 v4, 0x0 |
|
|
|
cmp-long v1, v2, v4 |
|
|
|
if-nez v1, :cond_0 |
|
|
|
.line 712 |
|
:goto_0 |
|
return v0 |
|
|
|
.line 707 |
|
:cond_0 |
|
int-to-long v2, p3 |
|
|
|
iget-wide v4, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J |
|
|
|
invoke-static {v2, v3, v4, v5}, Ljava/lang/Math;->min(JJ)J |
|
|
|
move-result-wide v2 |
|
|
|
long-to-int v1, v2 |
|
|
|
.line 708 |
|
iget-object v2, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->in:Ljava/io/InputStream; |
|
|
|
invoke-virtual {v2, p1, p2, v1}, Ljava/io/InputStream;->read([BII)I |
|
|
|
move-result v1 |
|
|
|
.line 709 |
|
if-eq v1, v0, :cond_1 |
|
|
|
.line 710 |
|
iget-wide v2, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J |
|
|
|
int-to-long v4, v1 |
|
|
|
sub-long/2addr v2, v4 |
|
|
|
iput-wide v2, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J |
|
|
|
:cond_1 |
|
move v0, v1 |
|
|
|
.line 712 |
|
goto :goto_0 |
|
.end method |
|
|
|
.method public declared-synchronized reset()V |
|
.locals 4 |
|
|
|
.prologue |
|
.line 716 |
|
monitor-enter p0 |
|
|
|
: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-nez v0, :cond_0 |
|
|
|
.line 717 |
|
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_0 |
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0 |
|
|
|
.line 716 |
|
:catchall_0 |
|
move-exception v0 |
|
|
|
monitor-exit p0 |
|
|
|
throw v0 |
|
|
|
.line 719 |
|
:cond_0 |
|
:try_start_1 |
|
iget-wide v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->mark:J |
|
|
|
const-wide/16 v2, -0x1 |
|
|
|
cmp-long v0, v0, v2 |
|
|
|
if-nez v0, :cond_1 |
|
|
|
.line 720 |
|
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 723 |
|
:cond_1 |
|
iget-object v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->in:Ljava/io/InputStream; |
|
|
|
invoke-virtual {v0}, Ljava/io/InputStream;->reset()V |
|
|
|
.line 724 |
|
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_1 |
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0 |
|
|
|
.line 725 |
|
monitor-exit p0 |
|
|
|
return-void |
|
.end method |
|
|
|
.method public skip(J)J |
|
.locals 5 |
|
|
|
.prologue |
|
.line 728 |
|
iget-wide v0, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J |
|
|
|
invoke-static {p1, p2, v0, v1}, Ljava/lang/Math;->min(JJ)J |
|
|
|
move-result-wide v0 |
|
|
|
.line 729 |
|
iget-object v2, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->in:Ljava/io/InputStream; |
|
|
|
invoke-virtual {v2, v0, v1}, Ljava/io/InputStream;->skip(J)J |
|
|
|
move-result-wide v0 |
|
|
|
.line 730 |
|
iget-wide v2, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J |
|
|
|
sub-long/2addr v2, v0 |
|
|
|
iput-wide v2, p0, Lcom/google/common/io/ByteStreams$LimitedInputStream;->left:J |
|
|
|
.line 731 |
|
return-wide v0 |
|
.end method
|
|
|