Java Stream Close closeSafely(InputStream is)

Here you can find the source of closeSafely(InputStream is)

Description

close Safely

License

Open Source License

Declaration

public static void closeSafely(InputStream is) 

Method Source Code

//package com.java2s;

import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;

public class Main {
    public static void closeSafely(InputStream is) {
        try {//from  w w w  .  j  a v  a 2s . c om
            if (is != null)
                is.close();
        } catch (Throwable e) {
        }
    }

    public static void closeSafely(OutputStream os) {
        try {
            if (os != null)
                os.close();
        } catch (Throwable e) {
        }
    }

    public static void closeSafely(Reader r) {
        try {
            if (r != null)
                r.close();
        } catch (Throwable e) {
        }
    }
}

Related

  1. closeRelaxed(Closeable resource)
  2. closeReportFile()
  3. closeResource(final Closeable aResource)
  4. closeSafe(InputStream inputStream)
  5. closeSafely(final FileOutputStream output)
  6. closeSafely(ZipInputStream zis)
  7. closeSecurityConfigurationFileInputStream(FileInputStream fis)
  8. closeSilently(final InputStream is)
  9. closeSilently(InputStream in)