139 lines
2.8 KiB
Smali
139 lines
2.8 KiB
Smali
.class public final Lcom/google/api/client/util/ByteStreams;
|
|
.super Ljava/lang/Object;
|
|
.source "ByteStreams.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/google/api/client/util/ByteStreams$LimitedInputStream;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field private static final BUF_SIZE:I = 0x1000
|
|
|
|
|
|
# direct methods
|
|
.method private constructor <init>()V
|
|
.locals 0
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static copy(Ljava/io/InputStream;Ljava/io/OutputStream;)J
|
|
.locals 5
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
invoke-static {p0}, Lcom/google/api/client/util/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
.line 2
|
|
invoke-static {p1}, Lcom/google/api/client/util/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
const/16 v0, 0x1000
|
|
|
|
new-array v0, v0, [B
|
|
|
|
const-wide/16 v1, 0x0
|
|
|
|
.line 3
|
|
:goto_0
|
|
invoke-virtual {p0, v0}, Ljava/io/InputStream;->read([B)I
|
|
|
|
move-result v3
|
|
|
|
const/4 v4, -0x1
|
|
|
|
if-ne v3, v4, :cond_0
|
|
|
|
return-wide v1
|
|
|
|
:cond_0
|
|
const/4 v4, 0x0
|
|
|
|
.line 4
|
|
invoke-virtual {p1, v0, v4, v3}, Ljava/io/OutputStream;->write([BII)V
|
|
|
|
int-to-long v3, v3
|
|
|
|
add-long/2addr v1, v3
|
|
|
|
goto :goto_0
|
|
.end method
|
|
|
|
.method public static limit(Ljava/io/InputStream;J)Ljava/io/InputStream;
|
|
.locals 1
|
|
|
|
.line 1
|
|
new-instance v0, Lcom/google/api/client/util/ByteStreams$LimitedInputStream;
|
|
|
|
invoke-direct {v0, p0, p1, p2}, Lcom/google/api/client/util/ByteStreams$LimitedInputStream;-><init>(Ljava/io/InputStream;J)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static read(Ljava/io/InputStream;[BII)I
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 1
|
|
invoke-static {p0}, Lcom/google/api/client/util/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
.line 2
|
|
invoke-static {p1}, Lcom/google/api/client/util/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
if-ltz p3, :cond_2
|
|
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
if-ge v0, p3, :cond_1
|
|
|
|
add-int v1, p2, v0
|
|
|
|
sub-int v2, p3, v0
|
|
|
|
.line 3
|
|
invoke-virtual {p0, p1, v1, v2}, Ljava/io/InputStream;->read([BII)I
|
|
|
|
move-result v1
|
|
|
|
const/4 v2, -0x1
|
|
|
|
if-ne v1, v2, :cond_0
|
|
|
|
goto :goto_1
|
|
|
|
:cond_0
|
|
add-int/2addr v0, v1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
:goto_1
|
|
return v0
|
|
|
|
.line 4
|
|
:cond_2
|
|
new-instance p0, Ljava/lang/IndexOutOfBoundsException;
|
|
|
|
const-string p1, "len is negative"
|
|
|
|
invoke-direct {p0, p1}, Ljava/lang/IndexOutOfBoundsException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p0
|
|
.end method
|