Here you can find the source of closeQuietly(InputStream is)
Parameter | Description |
---|---|
is | the input stream to be closed, may be <b>null</b> |
public static void closeQuietly(InputStream is)
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.jar.JarFile; public class Main { /**/*from ww w .j ava 2 s .com*/ * Closes the given JAR file without throwing an exception. * * @param file the JAR file to be closed, may be <b>null</b> */ public static void closeQuietly(JarFile file) { if (null != file) { try { file.close(); } catch (IOException e) { } } } /** * Closes the given input stream without throwing an exception. * * @param is the input stream to be closed, may be <b>null</b> */ public static void closeQuietly(InputStream is) { if (null != is) { try { is.close(); } catch (IOException e) { } } } /** * Closes the given output stream without throwing an exception. * * @param os the output stream to be closed, may be <b>null</b> */ public static void closeQuietly(OutputStream os) { if (null != os) { try { os.close(); } catch (IOException e) { } } } }