mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-26 17:12:31 -06:00
50 lines
1.3 KiB
Java
50 lines
1.3 KiB
Java
|
package com.google.common.io;
|
||
|
|
||
|
import java.io.Closeable;
|
||
|
import java.io.IOException;
|
||
|
import java.io.InputStream;
|
||
|
import java.io.Reader;
|
||
|
import java.util.logging.Level;
|
||
|
import java.util.logging.Logger;
|
||
|
import javax.annotation.CheckForNull;
|
||
|
|
||
|
@ElementTypesAreNonnullByDefault
|
||
|
/* loaded from: classes3.dex */
|
||
|
public final class Closeables {
|
||
|
static final Logger logger = Logger.getLogger(Closeables.class.getName());
|
||
|
|
||
|
private Closeables() {
|
||
|
}
|
||
|
|
||
|
public static void close(@CheckForNull Closeable closeable, boolean z) throws IOException {
|
||
|
if (closeable == null) {
|
||
|
return;
|
||
|
}
|
||
|
try {
|
||
|
closeable.close();
|
||
|
} catch (IOException e) {
|
||
|
if (z) {
|
||
|
logger.log(Level.WARNING, "IOException thrown while closing Closeable.", (Throwable) e);
|
||
|
return;
|
||
|
}
|
||
|
throw e;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void closeQuietly(@CheckForNull InputStream inputStream) {
|
||
|
try {
|
||
|
close(inputStream, true);
|
||
|
} catch (IOException e) {
|
||
|
throw new AssertionError(e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void closeQuietly(@CheckForNull Reader reader) {
|
||
|
try {
|
||
|
close(reader, true);
|
||
|
} catch (IOException e) {
|
||
|
throw new AssertionError(e);
|
||
|
}
|
||
|
}
|
||
|
}
|