Java Stream Close closeSafe(InputStream inputStream)

Here you can find the source of closeSafe(InputStream inputStream)

Description

close Safe

License

Apache License

Declaration

public static void closeSafe(InputStream inputStream) throws Exception 

Method Source Code


//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static void closeSafe(InputStream inputStream) throws Exception {
        if (inputStream != null) {
            inputStream.close();/*  www .j  av  a  2s .c om*/
        }
    }

    public static void closeSafe(OutputStream outputStream) throws Exception {
        if (outputStream != null) {
            outputStream.close();
        }
    }
}

Related

  1. closeReader(Reader reader)
  2. closeReader(Reader rReader)
  3. closeRelaxed(Closeable resource)
  4. closeReportFile()
  5. closeResource(final Closeable aResource)
  6. closeSafely(final FileOutputStream output)
  7. closeSafely(InputStream is)
  8. closeSafely(ZipInputStream zis)
  9. closeSecurityConfigurationFileInputStream(FileInputStream fis)