今奥全景相机
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.

336 lines
8.7 KiB

.class public final Lcom/google/common/io/Closer;
.super Ljava/lang/Object;
.source "Closer.java"
# interfaces
.implements Ljava/io/Closeable;
# annotations
.annotation build Lcom/google/common/annotations/Beta;
.end annotation
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/google/common/io/Closer$SuppressingSuppressor;,
Lcom/google/common/io/Closer$LoggingSuppressor;,
Lcom/google/common/io/Closer$Suppressor;
}
.end annotation
# static fields
.field private static final SUPPRESSOR:Lcom/google/common/io/Closer$Suppressor;
# instance fields
.field private final stack:Ljava/util/LinkedList;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/LinkedList",
"<",
"Ljava/io/Closeable;",
">;"
}
.end annotation
.end field
.field final suppressor:Lcom/google/common/io/Closer$Suppressor;
.annotation build Lcom/google/common/annotations/VisibleForTesting;
.end annotation
.end field
.field private thrown:Ljava/lang/Throwable;
# direct methods
.method static constructor <clinit>()V
.locals 1
.prologue
.line 95
invoke-static {}, Lcom/google/common/io/Closer$SuppressingSuppressor;->isAvailable()Z
move-result v0
if-eqz v0, :cond_0
sget-object v0, Lcom/google/common/io/Closer$SuppressingSuppressor;->INSTANCE:Lcom/google/common/io/Closer$SuppressingSuppressor;
:goto_0
sput-object v0, Lcom/google/common/io/Closer;->SUPPRESSOR:Lcom/google/common/io/Closer$Suppressor;
return-void
:cond_0
sget-object v0, Lcom/google/common/io/Closer$LoggingSuppressor;->INSTANCE:Lcom/google/common/io/Closer$LoggingSuppressor;
goto :goto_0
.end method
.method constructor <init>(Lcom/google/common/io/Closer$Suppressor;)V
.locals 1
.annotation build Lcom/google/common/annotations/VisibleForTesting;
.end annotation
.prologue
.line 112
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 109
new-instance v0, Ljava/util/LinkedList;
invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V
iput-object v0, p0, Lcom/google/common/io/Closer;->stack:Ljava/util/LinkedList;
.line 113
invoke-static {p1}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/google/common/io/Closer$Suppressor;
iput-object v0, p0, Lcom/google/common/io/Closer;->suppressor:Lcom/google/common/io/Closer$Suppressor;
.line 114
return-void
.end method
.method public static create()Lcom/google/common/io/Closer;
.locals 2
.prologue
.line 103
new-instance v0, Lcom/google/common/io/Closer;
sget-object v1, Lcom/google/common/io/Closer;->SUPPRESSOR:Lcom/google/common/io/Closer$Suppressor;
invoke-direct {v0, v1}, Lcom/google/common/io/Closer;-><init>(Lcom/google/common/io/Closer$Suppressor;)V
return-object v0
.end method
# virtual methods
.method public close()V
.locals 4
.prologue
.line 207
iget-object v1, p0, Lcom/google/common/io/Closer;->thrown:Ljava/lang/Throwable;
.line 210
:goto_0
iget-object v0, p0, Lcom/google/common/io/Closer;->stack:Ljava/util/LinkedList;
invoke-virtual {v0}, Ljava/util/LinkedList;->isEmpty()Z
move-result v0
if-nez v0, :cond_1
.line 211
iget-object v0, p0, Lcom/google/common/io/Closer;->stack:Ljava/util/LinkedList;
invoke-virtual {v0}, Ljava/util/LinkedList;->removeFirst()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/io/Closeable;
.line 213
:try_start_0
invoke-interface {v0}, Ljava/io/Closeable;->close()V
:try_end_0
.catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
move-object v0, v1
:goto_1
move-object v1, v0
.line 221
goto :goto_0
.line 214
:catch_0
move-exception v2
.line 215
if-nez v1, :cond_0
move-object v0, v2
.line 216
goto :goto_1
.line 218
:cond_0
iget-object v3, p0, Lcom/google/common/io/Closer;->suppressor:Lcom/google/common/io/Closer$Suppressor;
invoke-interface {v3, v0, v1, v2}, Lcom/google/common/io/Closer$Suppressor;->suppress(Ljava/io/Closeable;Ljava/lang/Throwable;Ljava/lang/Throwable;)V
move-object v0, v1
goto :goto_1
.line 223
:cond_1
iget-object v0, p0, Lcom/google/common/io/Closer;->thrown:Ljava/lang/Throwable;
if-nez v0, :cond_2
if-eqz v1, :cond_2
.line 224
const-class v0, Ljava/io/IOException;
invoke-static {v1, v0}, Lcom/google/common/base/Throwables;->propagateIfPossible(Ljava/lang/Throwable;Ljava/lang/Class;)V
.line 225
new-instance v0, Ljava/lang/AssertionError;
invoke-direct {v0, v1}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
throw v0
.line 227
:cond_2
return-void
.end method
.method public register(Ljava/io/Closeable;)Ljava/io/Closeable;
.locals 1
.param p1 # Ljava/io/Closeable;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.annotation system Ldalvik/annotation/Signature;
value = {
"<C::",
"Ljava/io/Closeable;",
">(TC;)TC;"
}
.end annotation
.prologue
.line 124
if-eqz p1, :cond_0
.line 125
iget-object v0, p0, Lcom/google/common/io/Closer;->stack:Ljava/util/LinkedList;
invoke-virtual {v0, p1}, Ljava/util/LinkedList;->addFirst(Ljava/lang/Object;)V
.line 128
:cond_0
return-object p1
.end method
.method public rethrow(Ljava/lang/Throwable;)Ljava/lang/RuntimeException;
.locals 1
.prologue
.line 145
invoke-static {p1}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 146
iput-object p1, p0, Lcom/google/common/io/Closer;->thrown:Ljava/lang/Throwable;
.line 147
const-class v0, Ljava/io/IOException;
invoke-static {p1, v0}, Lcom/google/common/base/Throwables;->propagateIfPossible(Ljava/lang/Throwable;Ljava/lang/Class;)V
.line 148
new-instance v0, Ljava/lang/RuntimeException;
invoke-direct {v0, p1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/Throwable;)V
throw v0
.end method
.method public rethrow(Ljava/lang/Throwable;Ljava/lang/Class;)Ljava/lang/RuntimeException;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"<X:",
"Ljava/lang/Exception;",
">(",
"Ljava/lang/Throwable;",
"Ljava/lang/Class",
"<TX;>;)",
"Ljava/lang/RuntimeException;",
"^",
"Ljava/io/IOException;",
"^TX;"
}
.end annotation
.prologue
.line 167
invoke-static {p1}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 168
iput-object p1, p0, Lcom/google/common/io/Closer;->thrown:Ljava/lang/Throwable;
.line 169
const-class v0, Ljava/io/IOException;
invoke-static {p1, v0}, Lcom/google/common/base/Throwables;->propagateIfPossible(Ljava/lang/Throwable;Ljava/lang/Class;)V
.line 170
invoke-static {p1, p2}, Lcom/google/common/base/Throwables;->propagateIfPossible(Ljava/lang/Throwable;Ljava/lang/Class;)V
.line 171
new-instance v0, Ljava/lang/RuntimeException;
invoke-direct {v0, p1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/Throwable;)V
throw v0
.end method
.method public rethrow(Ljava/lang/Throwable;Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/RuntimeException;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"<X1:",
"Ljava/lang/Exception;",
"X2:",
"Ljava/lang/Exception;",
">(",
"Ljava/lang/Throwable;",
"Ljava/lang/Class",
"<TX1;>;",
"Ljava/lang/Class",
"<TX2;>;)",
"Ljava/lang/RuntimeException;",
"^",
"Ljava/io/IOException;",
"^TX1;^TX2;"
}
.end annotation
.prologue
.line 191
invoke-static {p1}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 192
iput-object p1, p0, Lcom/google/common/io/Closer;->thrown:Ljava/lang/Throwable;
.line 193
const-class v0, Ljava/io/IOException;
invoke-static {p1, v0}, Lcom/google/common/base/Throwables;->propagateIfPossible(Ljava/lang/Throwable;Ljava/lang/Class;)V
.line 194
invoke-static {p1, p2, p3}, Lcom/google/common/base/Throwables;->propagateIfPossible(Ljava/lang/Throwable;Ljava/lang/Class;Ljava/lang/Class;)V
.line 195
new-instance v0, Ljava/lang/RuntimeException;
invoke-direct {v0, p1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/Throwable;)V
throw v0
.end method