Here you can find the source of close(InputStream is)
Parameter | Description |
---|---|
is | the stream to close, can be null |
public static void close(InputStream is)
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; import java.io.Writer; public class Main { /**/* ww w .j av a 2 s. co m*/ * Closes an input stream ignoring any errors. * * @param is the stream to close, can be null */ public static void close(InputStream is) { if (is == null) return; try { is.close(); } catch (IOException ignoreEx) { } } /** * Closes an output stream ignoring any errors. * * @param os the stream to close, can be null */ public static void close(OutputStream os) { if (os == null) return; try { os.close(); } catch (IOException ignoreEx) { } } /** * Closes a reader ignoring any errors. * * @param reader the reader to close, can be null */ public static void close(Reader reader) { if (reader == null) return; try { reader.close(); } catch (IOException ignoreEx) { } } /** * Closes a writer ignoring any errors. * * @param writer the writer to close, can be null */ public static void close(Writer writer) { if (writer == null) return; try { writer.close(); } catch (IOException ignoreEx) { } } }