Files
2020-08-27 12:38:23 +08:00

32 lines
797 B
Java

package com.proxgrind.chameleon.utils.stream;
import androidx.annotation.Nullable;
import java.io.Closeable;
import java.io.Flushable;
import java.io.IOException;
public class IOUtils {
public static boolean close(@Nullable Closeable closeable) {
if (closeable == null) return false;
try {
closeable.close();
return true;
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
public static boolean flush(@Nullable Flushable flushable) {
if (flushable == null) return false;
try {
flushable.flush();
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
}