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.
334 lines
8.4 KiB
334 lines
8.4 KiB
.class public final Lcom/google/common/io/Resources; |
|
.super Ljava/lang/Object; |
|
.source "Resources.java" |
|
|
|
|
|
# annotations |
|
.annotation build Lcom/google/common/annotations/Beta; |
|
.end annotation |
|
|
|
.annotation system Ldalvik/annotation/MemberClasses; |
|
value = { |
|
Lcom/google/common/io/Resources$UrlByteSource; |
|
} |
|
.end annotation |
|
|
|
|
|
# direct methods |
|
.method private constructor <init>()V |
|
.locals 0 |
|
|
|
.prologue |
|
.line 49 |
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V |
|
|
|
return-void |
|
.end method |
|
|
|
.method public static asByteSource(Ljava/net/URL;)Lcom/google/common/io/ByteSource; |
|
.locals 2 |
|
|
|
.prologue |
|
.line 71 |
|
new-instance v0, Lcom/google/common/io/Resources$UrlByteSource; |
|
|
|
const/4 v1, 0x0 |
|
|
|
invoke-direct {v0, p0, v1}, Lcom/google/common/io/Resources$UrlByteSource;-><init>(Ljava/net/URL;Lcom/google/common/io/Resources$1;)V |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method public static asCharSource(Ljava/net/URL;Ljava/nio/charset/Charset;)Lcom/google/common/io/CharSource; |
|
.locals 1 |
|
|
|
.prologue |
|
.line 120 |
|
invoke-static {p0}, Lcom/google/common/io/Resources;->asByteSource(Ljava/net/URL;)Lcom/google/common/io/ByteSource; |
|
|
|
move-result-object v0 |
|
|
|
invoke-virtual {v0, p1}, Lcom/google/common/io/ByteSource;->asCharSource(Ljava/nio/charset/Charset;)Lcom/google/common/io/CharSource; |
|
|
|
move-result-object v0 |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method public static copy(Ljava/net/URL;Ljava/io/OutputStream;)V |
|
.locals 1 |
|
|
|
.prologue |
|
.line 207 |
|
invoke-static {p0}, Lcom/google/common/io/Resources;->asByteSource(Ljava/net/URL;)Lcom/google/common/io/ByteSource; |
|
|
|
move-result-object v0 |
|
|
|
invoke-virtual {v0, p1}, Lcom/google/common/io/ByteSource;->copyTo(Ljava/io/OutputStream;)J |
|
|
|
.line 208 |
|
return-void |
|
.end method |
|
|
|
.method public static getResource(Ljava/lang/Class;Ljava/lang/String;)Ljava/net/URL; |
|
.locals 6 |
|
.annotation system Ldalvik/annotation/Signature; |
|
value = { |
|
"(", |
|
"Ljava/lang/Class", |
|
"<*>;", |
|
"Ljava/lang/String;", |
|
")", |
|
"Ljava/net/URL;" |
|
} |
|
.end annotation |
|
|
|
.prologue |
|
const/4 v1, 0x1 |
|
|
|
const/4 v2, 0x0 |
|
|
|
.line 240 |
|
invoke-virtual {p0, p1}, Ljava/lang/Class;->getResource(Ljava/lang/String;)Ljava/net/URL; |
|
|
|
move-result-object v3 |
|
|
|
.line 241 |
|
if-eqz v3, :cond_0 |
|
|
|
move v0, v1 |
|
|
|
:goto_0 |
|
const-string v4, "resource %s relative to %s not found." |
|
|
|
const/4 v5, 0x2 |
|
|
|
new-array v5, v5, [Ljava/lang/Object; |
|
|
|
aput-object p1, v5, v2 |
|
|
|
invoke-virtual {p0}, Ljava/lang/Class;->getName()Ljava/lang/String; |
|
|
|
move-result-object v2 |
|
|
|
aput-object v2, v5, v1 |
|
|
|
invoke-static {v0, v4, v5}, Lcom/google/common/base/Preconditions;->checkArgument(ZLjava/lang/String;[Ljava/lang/Object;)V |
|
|
|
.line 243 |
|
return-object v3 |
|
|
|
:cond_0 |
|
move v0, v2 |
|
|
|
.line 241 |
|
goto :goto_0 |
|
.end method |
|
|
|
.method public static getResource(Ljava/lang/String;)Ljava/net/URL; |
|
.locals 5 |
|
|
|
.prologue |
|
const/4 v1, 0x1 |
|
|
|
const/4 v2, 0x0 |
|
|
|
.line 225 |
|
invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread; |
|
|
|
move-result-object v0 |
|
|
|
invoke-virtual {v0}, Ljava/lang/Thread;->getContextClassLoader()Ljava/lang/ClassLoader; |
|
|
|
move-result-object v0 |
|
|
|
const-class v3, Lcom/google/common/io/Resources; |
|
|
|
invoke-virtual {v3}, Ljava/lang/Class;->getClassLoader()Ljava/lang/ClassLoader; |
|
|
|
move-result-object v3 |
|
|
|
invoke-static {v0, v3}, Lcom/google/common/base/Objects;->firstNonNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; |
|
|
|
move-result-object v0 |
|
|
|
check-cast v0, Ljava/lang/ClassLoader; |
|
|
|
.line 228 |
|
invoke-virtual {v0, p0}, Ljava/lang/ClassLoader;->getResource(Ljava/lang/String;)Ljava/net/URL; |
|
|
|
move-result-object v3 |
|
|
|
.line 229 |
|
if-eqz v3, :cond_0 |
|
|
|
move v0, v1 |
|
|
|
:goto_0 |
|
const-string v4, "resource %s not found." |
|
|
|
new-array v1, v1, [Ljava/lang/Object; |
|
|
|
aput-object p0, v1, v2 |
|
|
|
invoke-static {v0, v4, v1}, Lcom/google/common/base/Preconditions;->checkArgument(ZLjava/lang/String;[Ljava/lang/Object;)V |
|
|
|
.line 230 |
|
return-object v3 |
|
|
|
:cond_0 |
|
move v0, v2 |
|
|
|
.line 229 |
|
goto :goto_0 |
|
.end method |
|
|
|
.method public static newInputStreamSupplier(Ljava/net/URL;)Lcom/google/common/io/InputSupplier; |
|
.locals 1 |
|
.annotation system Ldalvik/annotation/Signature; |
|
value = { |
|
"(", |
|
"Ljava/net/URL;", |
|
")", |
|
"Lcom/google/common/io/InputSupplier", |
|
"<", |
|
"Ljava/io/InputStream;", |
|
">;" |
|
} |
|
.end annotation |
|
|
|
.annotation runtime Ljava/lang/Deprecated; |
|
.end annotation |
|
|
|
.prologue |
|
.line 62 |
|
invoke-static {p0}, Lcom/google/common/io/Resources;->asByteSource(Ljava/net/URL;)Lcom/google/common/io/ByteSource; |
|
|
|
move-result-object v0 |
|
|
|
invoke-static {v0}, Lcom/google/common/io/ByteStreams;->asInputSupplier(Lcom/google/common/io/ByteSource;)Lcom/google/common/io/InputSupplier; |
|
|
|
move-result-object v0 |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method public static newReaderSupplier(Ljava/net/URL;Ljava/nio/charset/Charset;)Lcom/google/common/io/InputSupplier; |
|
.locals 1 |
|
.annotation system Ldalvik/annotation/Signature; |
|
value = { |
|
"(", |
|
"Ljava/net/URL;", |
|
"Ljava/nio/charset/Charset;", |
|
")", |
|
"Lcom/google/common/io/InputSupplier", |
|
"<", |
|
"Ljava/io/InputStreamReader;", |
|
">;" |
|
} |
|
.end annotation |
|
|
|
.annotation runtime Ljava/lang/Deprecated; |
|
.end annotation |
|
|
|
.prologue |
|
.line 110 |
|
invoke-static {p0, p1}, Lcom/google/common/io/Resources;->asCharSource(Ljava/net/URL;Ljava/nio/charset/Charset;)Lcom/google/common/io/CharSource; |
|
|
|
move-result-object v0 |
|
|
|
invoke-static {v0}, Lcom/google/common/io/CharStreams;->asInputSupplier(Lcom/google/common/io/CharSource;)Lcom/google/common/io/InputSupplier; |
|
|
|
move-result-object v0 |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method public static readLines(Ljava/net/URL;Ljava/nio/charset/Charset;Lcom/google/common/io/LineProcessor;)Ljava/lang/Object; |
|
.locals 1 |
|
.annotation system Ldalvik/annotation/Signature; |
|
value = { |
|
"<T:", |
|
"Ljava/lang/Object;", |
|
">(", |
|
"Ljava/net/URL;", |
|
"Ljava/nio/charset/Charset;", |
|
"Lcom/google/common/io/LineProcessor", |
|
"<TT;>;)TT;" |
|
} |
|
.end annotation |
|
|
|
.prologue |
|
.line 161 |
|
invoke-static {p0, p1}, Lcom/google/common/io/Resources;->newReaderSupplier(Ljava/net/URL;Ljava/nio/charset/Charset;)Lcom/google/common/io/InputSupplier; |
|
|
|
move-result-object v0 |
|
|
|
invoke-static {v0, p2}, Lcom/google/common/io/CharStreams;->readLines(Lcom/google/common/io/InputSupplier;Lcom/google/common/io/LineProcessor;)Ljava/lang/Object; |
|
|
|
move-result-object v0 |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method public static readLines(Ljava/net/URL;Ljava/nio/charset/Charset;)Ljava/util/List; |
|
.locals 1 |
|
.annotation system Ldalvik/annotation/Signature; |
|
value = { |
|
"(", |
|
"Ljava/net/URL;", |
|
"Ljava/nio/charset/Charset;", |
|
")", |
|
"Ljava/util/List", |
|
"<", |
|
"Ljava/lang/String;", |
|
">;" |
|
} |
|
.end annotation |
|
|
|
.prologue |
|
.line 183 |
|
new-instance v0, Lcom/google/common/io/Resources$1; |
|
|
|
invoke-direct {v0}, Lcom/google/common/io/Resources$1;-><init>()V |
|
|
|
invoke-static {p0, p1, v0}, Lcom/google/common/io/Resources;->readLines(Ljava/net/URL;Ljava/nio/charset/Charset;Lcom/google/common/io/LineProcessor;)Ljava/lang/Object; |
|
|
|
move-result-object v0 |
|
|
|
check-cast v0, Ljava/util/List; |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method public static toByteArray(Ljava/net/URL;)[B |
|
.locals 1 |
|
|
|
.prologue |
|
.line 131 |
|
invoke-static {p0}, Lcom/google/common/io/Resources;->asByteSource(Ljava/net/URL;)Lcom/google/common/io/ByteSource; |
|
|
|
move-result-object v0 |
|
|
|
invoke-virtual {v0}, Lcom/google/common/io/ByteSource;->read()[B |
|
|
|
move-result-object v0 |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method public static toString(Ljava/net/URL;Ljava/nio/charset/Charset;)Ljava/lang/String; |
|
.locals 1 |
|
|
|
.prologue |
|
.line 145 |
|
invoke-static {p0, p1}, Lcom/google/common/io/Resources;->asCharSource(Ljava/net/URL;Ljava/nio/charset/Charset;)Lcom/google/common/io/CharSource; |
|
|
|
move-result-object v0 |
|
|
|
invoke-virtual {v0}, Lcom/google/common/io/CharSource;->read()Ljava/lang/String; |
|
|
|
move-result-object v0 |
|
|
|
return-object v0 |
|
.end method
|
|
|