Java InputStream Close close(InputStream in)

Here you can find the source of close(InputStream in)

Description

close

License

Open Source License

Declaration

public static void close(InputStream in) 

Method Source Code


//package com.java2s;
import java.io.IOException;
import java.io.InputStream;

import java.io.OutputStream;

import java.io.Writer;

public class Main {
    public static void close(Writer writer) {
        if (writer != null) {
            try {
                writer.flush();/*from ww  w . j  a  v  a2 s  .c  om*/
            } catch (IOException ignore) {
            }
            try {
                writer.close();
            } catch (IOException ignore) {
            }
        }
    }

    public static void close(OutputStream out) {
        if (out != null) {
            try {
                out.flush();
            } catch (IOException ignore) {
            }
            try {
                out.close();
            } catch (IOException ignore) {
            }
        }
    }

    public static void close(InputStream in) {
        if (in != null) {
            try {
                in.close();
            } catch (IOException ignore) {
            }
        }
    }
}

Related

  1. close(InputStream in)
  2. close(InputStream in)
  3. close(InputStream in)
  4. close(InputStream in)
  5. close(InputStream in)
  6. close(InputStream in)
  7. close(InputStream in)
  8. close(InputStream in, boolean silent)
  9. close(InputStream in, OutputStream out)