Java Stream Close closeQuietly(InputStream input)

Here you can find the source of closeQuietly(InputStream input)

Description

close Quietly

License

Open Source License

Parameter

Parameter Description
input A (possibly null) InputStream

Declaration

public static void closeQuietly(InputStream input) 

Method Source Code


//package com.java2s;
import java.io.*;

public class Main {
    /**//from w  w  w . ja  va 2s.  com
     * @param input A (possibly null) Reader
     */
    public static void closeQuietly(Reader input) {
        if (input == null) {
            return;
        }

        try {
            input.close();
        } catch (IOException ioe) {
        }
    }

    /**
     * @param output A (possibly null) Writer
     */
    public static void closeQuietly(Writer output) {
        if (output == null) {
            return;
        }

        try {
            output.close();
        } catch (IOException ioe) {
        }
    }

    /**
     * @param output A (possibly null) OutputStream
     */
    public static void closeQuietly(OutputStream output) {
        if (output == null) {
            return;
        }

        try {
            output.close();
        } catch (IOException ioe) {
        }
    }

    /**
     * @param input A (possibly null) InputStream
     */
    public static void closeQuietly(InputStream input) {
        if (input == null) {
            return;
        }

        try {
            input.close();
        } catch (IOException ioe) {
        }
    }
}

Related

  1. closeQuietly(InputStream in)
  2. closeQuietly(InputStream input)
  3. closeQuietly(InputStream input)
  4. closeQuietly(InputStream input)
  5. closeQuietly(InputStream input)
  6. closeQuietly(InputStream input)
  7. closeQuietly(InputStream inputstream)
  8. closeQuietly(InputStream is)
  9. closeQuietly(InputStream is)