Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1267)

Unified Diff: base/android/java/src/org/chromium/base/StreamUtil.java

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/android/java/src/org/chromium/base/StreamUtil.java
diff --git a/base/android/java/src/org/chromium/base/StreamUtil.java b/base/android/java/src/org/chromium/base/StreamUtil.java
new file mode 100644
index 0000000000000000000000000000000000000000..f8cbfeeb9ede22580c5cac44ec35332708439ab7
--- /dev/null
+++ b/base/android/java/src/org/chromium/base/StreamUtil.java
@@ -0,0 +1,28 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.base;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * Helper methods to deal with stream related tasks.
+ */
+public class StreamUtil {
+ /**
+ * Handle closing a {@link java.io.Closeable} via {@link java.io.Closeable#close()} and catch
+ * the potentially thrown {@link java.io.IOException}.
+ * @param closeable The Closeable to be closed.
+ */
+ public static void closeQuietly(Closeable closeable) {
+ if (closeable == null) return;
+
+ try {
+ closeable.close();
+ } catch (IOException ex) {
+ // Ignore the exception on close.
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698