Java Stream Close closeQuietly(final InputStream in)

Here you can find the source of closeQuietly(final InputStream in)

Description

close Quietly

License

Open Source License

Declaration

public static void closeQuietly(final InputStream in) 

Method Source Code


//package com.java2s;

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

public class Main {
    public static void closeQuietly(final InputStream in) {
        if (in != null) {
            try {
                in.close();/*  w w  w  .j a va 2s . c o  m*/
            } catch (IOException ioe) {
                // ignore
            }
        }
    }

    public static void closeQuietly(final Reader reader) {
        if (reader != null) {
            try {
                reader.close();
            } catch (IOException ioe) {
                // ignore
            }
        }
    }

    public static void closeQuietly(final OutputStream in) {
        if (in != null) {
            try {
                in.close();
            } catch (IOException ioe) {
                // ignore
            }
        }
    }
}

Related

  1. closeQuietly(@Nullable ObjectInput in)
  2. closeQuietly(BufferedReader br)
  3. closeQuietly(Closeable input, Logger log)
  4. closeQuietly(Closeable stream)
  5. closeQuietly(Closeable stream)
  6. closeQuietly(final InputStream inputStream)
  7. closeQuietly(final Reader reader)
  8. closeQuietly(final ZipFile... zipFiles)
  9. closeQuietly(ImageInputStream ins)