You've already forked ChameleonBLEAPI
mirror of
https://github.com/RfidResearchGroup/ChameleonBLEAPI.git
synced 2026-05-12 11:20:47 -07:00
32 lines
797 B
Java
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;
|
|
}
|
|
}
|
|
}
|