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

458 lines
11 KiB
Smali

.class final Lcom/google/common/io/ByteSource$SlicedByteSource;
.super Lcom/google/common/io/ByteSource;
.source "ByteSource.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/google/common/io/ByteSource;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x12
name = "SlicedByteSource"
.end annotation
# instance fields
.field final length:J
.field final offset:J
.field final synthetic this$0:Lcom/google/common/io/ByteSource;
# direct methods
.method constructor <init>(Lcom/google/common/io/ByteSource;JJ)V
.locals 5
iput-object p1, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->this$0:Lcom/google/common/io/ByteSource;
.line 501
invoke-direct {p0}, Lcom/google/common/io/ByteSource;-><init>()V
const-wide/16 v0, 0x0
cmp-long p1, p2, v0
const/4 v2, 0x1
const/4 v3, 0x0
if-ltz p1, :cond_0
move p1, v2
goto :goto_0
:cond_0
move p1, v3
:goto_0
const-string v4, "offset (%s) may not be negative"
.line 502
invoke-static {p1, v4, p2, p3}, Lcom/google/common/base/Preconditions;->checkArgument(ZLjava/lang/String;J)V
cmp-long p1, p4, v0
if-ltz p1, :cond_1
goto :goto_1
:cond_1
move v2, v3
:goto_1
const-string p1, "length (%s) may not be negative"
.line 503
invoke-static {v2, p1, p4, p5}, Lcom/google/common/base/Preconditions;->checkArgument(ZLjava/lang/String;J)V
iput-wide p2, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->offset:J
iput-wide p4, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->length:J
return-void
.end method
.method private sliceStream(Ljava/io/InputStream;)Ljava/io/InputStream;
.locals 4
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
iget-wide v0, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->offset:J
const-wide/16 v2, 0x0
cmp-long v2, v0, v2
if-lez v2, :cond_0
.line 522
:try_start_0
invoke-static {p1, v0, v1}, Lcom/google/common/io/ByteStreams;->skipUpTo(Ljava/io/InputStream;J)J
move-result-wide v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
iget-wide v2, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->offset:J
cmp-long v0, v0, v2
if-gez v0, :cond_0
.line 535
invoke-virtual {p1}, Ljava/io/InputStream;->close()V
.line 536
new-instance p0, Ljava/io/ByteArrayInputStream;
const/4 p1, 0x0
new-array p1, p1, [B
invoke-direct {p0, p1}, Ljava/io/ByteArrayInputStream;-><init>([B)V
return-object p0
:catchall_0
move-exception p0
.line 524
invoke-static {}, Lcom/google/common/io/Closer;->create()Lcom/google/common/io/Closer;
move-result-object v0
.line 525
invoke-virtual {v0, p1}, Lcom/google/common/io/Closer;->register(Ljava/io/Closeable;)Ljava/io/Closeable;
.line 527
:try_start_1
invoke-virtual {v0, p0}, Lcom/google/common/io/Closer;->rethrow(Ljava/lang/Throwable;)Ljava/lang/RuntimeException;
move-result-object p0
throw p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_1
:catchall_1
move-exception p0
.line 529
invoke-virtual {v0}, Lcom/google/common/io/Closer;->close()V
.line 530
throw p0
:cond_0
iget-wide v0, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->length:J
.line 539
invoke-static {p1, v0, v1}, Lcom/google/common/io/ByteStreams;->limit(Ljava/io/InputStream;J)Ljava/io/InputStream;
move-result-object p0
return-object p0
.end method
# virtual methods
.method public isEmpty()Z
.locals 4
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
iget-wide v0, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->length:J
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-eqz v0, :cond_1
.line 554
invoke-super {p0}, Lcom/google/common/io/ByteSource;->isEmpty()Z
move-result p0
if-eqz p0, :cond_0
goto :goto_0
:cond_0
const/4 p0, 0x0
goto :goto_1
:cond_1
:goto_0
const/4 p0, 0x1
:goto_1
return p0
.end method
.method public openBufferedStream()Ljava/io/InputStream;
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
iget-object v0, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->this$0:Lcom/google/common/io/ByteSource;
.line 515
invoke-virtual {v0}, Lcom/google/common/io/ByteSource;->openBufferedStream()Ljava/io/InputStream;
move-result-object v0
invoke-direct {p0, v0}, Lcom/google/common/io/ByteSource$SlicedByteSource;->sliceStream(Ljava/io/InputStream;)Ljava/io/InputStream;
move-result-object p0
return-object p0
.end method
.method public openStream()Ljava/io/InputStream;
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
iget-object v0, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->this$0:Lcom/google/common/io/ByteSource;
.line 510
invoke-virtual {v0}, Lcom/google/common/io/ByteSource;->openStream()Ljava/io/InputStream;
move-result-object v0
invoke-direct {p0, v0}, Lcom/google/common/io/ByteSource$SlicedByteSource;->sliceStream(Ljava/io/InputStream;)Ljava/io/InputStream;
move-result-object p0
return-object p0
.end method
.method public sizeIfKnown()Lcom/google/common/base/Optional;
.locals 6
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Lcom/google/common/base/Optional<",
"Ljava/lang/Long;",
">;"
}
.end annotation
iget-object v0, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->this$0:Lcom/google/common/io/ByteSource;
.line 559
invoke-virtual {v0}, Lcom/google/common/io/ByteSource;->sizeIfKnown()Lcom/google/common/base/Optional;
move-result-object v0
.line 560
invoke-virtual {v0}, Lcom/google/common/base/Optional;->isPresent()Z
move-result v1
if-eqz v1, :cond_0
.line 561
invoke-virtual {v0}, Lcom/google/common/base/Optional;->get()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/Long;
invoke-virtual {v0}, Ljava/lang/Long;->longValue()J
move-result-wide v0
iget-wide v2, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->offset:J
.line 562
invoke-static {v2, v3, v0, v1}, Ljava/lang/Math;->min(JJ)J
move-result-wide v2
iget-wide v4, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->length:J
sub-long/2addr v0, v2
.line 563
invoke-static {v4, v5, v0, v1}, Ljava/lang/Math;->min(JJ)J
move-result-wide v0
invoke-static {v0, v1}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object p0
invoke-static {p0}, Lcom/google/common/base/Optional;->of(Ljava/lang/Object;)Lcom/google/common/base/Optional;
move-result-object p0
return-object p0
.line 565
:cond_0
invoke-static {}, Lcom/google/common/base/Optional;->absent()Lcom/google/common/base/Optional;
move-result-object p0
return-object p0
.end method
.method public slice(JJ)Lcom/google/common/io/ByteSource;
.locals 6
const-wide/16 v0, 0x0
cmp-long v2, p1, v0
const/4 v3, 0x1
const/4 v4, 0x0
if-ltz v2, :cond_0
move v2, v3
goto :goto_0
:cond_0
move v2, v4
:goto_0
const-string v5, "offset (%s) may not be negative"
.line 544
invoke-static {v2, v5, p1, p2}, Lcom/google/common/base/Preconditions;->checkArgument(ZLjava/lang/String;J)V
cmp-long v2, p3, v0
if-ltz v2, :cond_1
goto :goto_1
:cond_1
move v3, v4
:goto_1
const-string v2, "length (%s) may not be negative"
.line 545
invoke-static {v3, v2, p3, p4}, Lcom/google/common/base/Preconditions;->checkArgument(ZLjava/lang/String;J)V
iget-wide v2, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->length:J
sub-long/2addr v2, p1
cmp-long v0, v2, v0
if-gtz v0, :cond_2
.line 548
invoke-static {}, Lcom/google/common/io/ByteSource;->empty()Lcom/google/common/io/ByteSource;
move-result-object p0
goto :goto_2
:cond_2
iget-object v0, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->this$0:Lcom/google/common/io/ByteSource;
iget-wide v4, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->offset:J
add-long/2addr v4, p1
.line 549
invoke-static {p3, p4, v2, v3}, Ljava/lang/Math;->min(JJ)J
move-result-wide p0
invoke-virtual {v0, v4, v5, p0, p1}, Lcom/google/common/io/ByteSource;->slice(JJ)Lcom/google/common/io/ByteSource;
move-result-object p0
:goto_2
return-object p0
.end method
.method public toString()Ljava/lang/String;
.locals 6
iget-object v0, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->this$0:Lcom/google/common/io/ByteSource;
.line 570
invoke-virtual {v0}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object v0
iget-wide v1, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->offset:J
iget-wide v3, p0, Lcom/google/common/io/ByteSource$SlicedByteSource;->length:J
invoke-static {v0}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
move-result-object p0
invoke-virtual {p0}, Ljava/lang/String;->length()I
move-result p0
add-int/lit8 p0, p0, 0x32
new-instance v5, Ljava/lang/StringBuilder;
invoke-direct {v5, p0}, Ljava/lang/StringBuilder;-><init>(I)V
invoke-virtual {v5, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p0
const-string v0, ".slice("
invoke-virtual {p0, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p0
invoke-virtual {p0, v1, v2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
move-result-object p0
const-string v0, ", "
invoke-virtual {p0, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p0
invoke-virtual {p0, v3, v4}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
move-result-object p0
const-string v0, ")"
invoke-virtual {p0, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p0
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
return-object p0
.end method