1/* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.support.provider; 18 19import android.support.annotation.Nullable; 20 21import java.io.Closeable; 22import java.io.InputStream; 23import java.util.Collection; 24 25/** 26 * Simple static methods to perform common IO operations. 27 * @hide 28 */ 29final class IoUtils { 30 static void closeQuietly(@Nullable Closeable closeable) { 31 if (closeable != null) { 32 try { 33 closeable.close(); 34 } catch (RuntimeException e) { 35 throw e; 36 } catch (Exception e) { 37 // Ignore. 38 } 39 } 40 } 41 42 static void closeQuietly(@Nullable InputStream stream) { 43 if (stream != null) { 44 try { 45 stream.close(); 46 } catch (RuntimeException e) { 47 throw e; 48 } catch (Exception e) { 49 // Ignore. 50 } 51 } 52 } 53} 54