Here you can find the source of close(InputStream is)
public static void close(InputStream is)
//package com.java2s; /******************************************************************************* * Copyright (c) 2018 Arrow Electronics, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License 2.0 * which accompanies this distribution, and is available at * http://apache.org/licenses/LICENSE-2.0 * * Contributors://from ww w . j av a 2s .co m * Arrow Electronics, Inc. *******************************************************************************/ import java.io.Closeable; import java.io.InputStream; public class Main { public static void close(InputStream is) { try { if (is != null) is.close(); } catch (Throwable t) { } } public static void close(Closeable closeable) { try { if (closeable != null) closeable.close(); } catch (Throwable t) { } } }