OSDN Git Service

Redundant/duplicate method to close Streams
authorisaid <isaid@google.com>
Sat, 3 Jun 2017 00:07:01 +0000 (20:07 -0400)
committerisaid <isaid@google.com>
Tue, 6 Jun 2017 18:20:02 +0000 (14:20 -0400)
Fixes: 62304559
Test: the code compiles which mean polymorphism works. No additional
tests necessary
Change-Id: I3d366f12c1f176213979da6b050957bc2adb2938

drm/java/android/drm/DrmUtils.java

index 2a86996..60ee6d9 100644 (file)
@@ -17,6 +17,7 @@
 package android.drm;
 
 import java.io.BufferedInputStream;
+import java.io.Closeable;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
@@ -79,26 +80,16 @@ public class DrmUtils {
         file.delete();
     }
 
-    private static void quietlyDispose(InputStream stream) {
+    private static void quietlyDispose(Closeable closable) {
         try {
-            if (null != stream) {
-                stream.close();
+            if (null != closable) {
+                closable.close();
             }
         } catch (IOException e) {
             // no need to care, at least as of now
         }
     }
 
-    private static void quietlyDispose(OutputStream stream) {
-        try {
-            if (null != stream) {
-                stream.close();
-            }
-        } catch (IOException e) {
-            // no need to care
-        }
-    }
-
     /**
      * Gets an instance of {@link DrmUtils.ExtendedMetadataParser}, which can be used to parse
      * extended metadata embedded in DRM constraint information.