Java Stream Close closeSilently(final InputStream is)

Here you can find the source of closeSilently(final InputStream is)

Description

close Silently

License

Open Source License

Declaration

public static void closeSilently(final InputStream is) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class Main {
    public static void closeSilently(final InputStream is) {
        if (is != null) {
            try {
                is.close();/*from  w ww .j a v a 2s  . c  om*/
            } catch (final IOException ignored) {
            }
        }
    }

    public static void closeSilently(final OutputStream os) {
        if (os != null) {
            try {
                os.close();
            } catch (final IOException ignored) {
            }
        }
    }
}

Related

  1. closeSafe(InputStream inputStream)
  2. closeSafely(final FileOutputStream output)
  3. closeSafely(InputStream is)
  4. closeSafely(ZipInputStream zis)
  5. closeSecurityConfigurationFileInputStream(FileInputStream fis)
  6. closeSilently(InputStream in)
  7. closeSilently(InputStream inputStream)
  8. closeSilently(InputStream... inputStreams)
  9. closeSilently(java.util.logging.Logger log, Closeable stream)