diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2013-01-10 11:24:58 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2013-01-10 11:24:58 +0100 |
| commit | c1d59fe48187f50c5b2c6d7ae6ceadd28a0d0e14 (patch) | |
| tree | a1c843b98619fc082dbd3a6f5066b8a595818f50 /main/src/cgeo/geocaching/utils/IOUtils.java | |
| parent | 51380614b1c9b5c79cd90ca9eb072bc771dfc7af (diff) | |
| download | cgeo-c1d59fe48187f50c5b2c6d7ae6ceadd28a0d0e14.zip cgeo-c1d59fe48187f50c5b2c6d7ae6ceadd28a0d0e14.tar.gz cgeo-c1d59fe48187f50c5b2c6d7ae6ceadd28a0d0e14.tar.bz2 | |
Do not depend on mapsforge in non-maps related classes
This feels like an inversion of dependencies to depend on mapsforge in
non-maps related classes. As closeQuietly() is useful, we can import it
into our utility class without requiring this dependency.
Diffstat (limited to 'main/src/cgeo/geocaching/utils/IOUtils.java')
| -rw-r--r-- | main/src/cgeo/geocaching/utils/IOUtils.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/utils/IOUtils.java b/main/src/cgeo/geocaching/utils/IOUtils.java new file mode 100644 index 0000000..73db12f --- /dev/null +++ b/main/src/cgeo/geocaching/utils/IOUtils.java @@ -0,0 +1,20 @@ +package cgeo.geocaching.utils; + +import java.io.Closeable; +import java.io.IOException; + +final public class IOUtils { + + private IOUtils() {} + + public static void closeQuietly(final Closeable closeable) { + if (closeable != null) { + try { + closeable.close(); + } catch (final IOException e) { + Log.w("closeQuietly: unable to close " + closeable, e); + } + } + } + +} |
