mirror of
https://github.com/oasisfeng/deagle.git
synced 2025-01-09 04:10:03 +08:00
ADD: IoUtils.
This commit is contained in:
parent
f70a4a6f79
commit
8cd9333078
28
library/src/main/java/com/oasisfeng/java/utils/IoUtils.java
Normal file
28
library/src/main/java/com/oasisfeng/java/utils/IoUtils.java
Normal file
@ -0,0 +1,28 @@
|
||||
package com.oasisfeng.java.utils;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.InputStream;
|
||||
|
||||
/** Simple static methods to perform common IO operations. */
|
||||
public final class IoUtils {
|
||||
|
||||
public static void closeQuietly(final @Nullable Closeable closeable) {
|
||||
if (closeable == null) return;
|
||||
try {
|
||||
closeable.close();
|
||||
} catch (final RuntimeException e) {
|
||||
throw e;
|
||||
} catch (final Exception ignored) {}
|
||||
}
|
||||
|
||||
public static void closeQuietly(final @Nullable InputStream stream) {
|
||||
if (stream == null) return;
|
||||
try {
|
||||
stream.close();
|
||||
} catch (final RuntimeException e) {
|
||||
throw e;
|
||||
} catch (final Exception ignored) {}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user