io: Added IO helper class.

Contains static helper method to close Closable objects.
This commit is contained in:
eho 2018-03-26 23:45:19 +02:00
parent 174df6e7a2
commit cd065887dd

View file

@ -0,0 +1,24 @@
package com.owncloud.android.utils;
import com.owncloud.android.lib.common.utils.Log_OC;
import java.io.Closeable;
import java.io.IOException;
/**
* Static system IO helper methods
*/
public class IOHelper {
private static final String TAG = IOHelper.class.getSimpleName();
public static void close(Closeable c) {
if (c == null) return;
try {
c.close();
} catch (IOException e) {
Log_OC.e(TAG, "Error closing stream", e);
}
}
}