Java InputStream Close close(InputStream is)

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

Description

close

License

Open Source License

Declaration

static public void close(InputStream is) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.util.jar.JarFile;

public class Main {
    static public void close(Reader reader) {
        if (reader != null) {
            try {
                reader.close();//from  ww w. j  a  v  a  2  s .c o  m
            } catch (IOException e) {
                // ignore
            }
        }
    }

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

    static public void close(Writer writer) {
        if (writer != null)
            try {
                writer.close();
            } catch (IOException e) {
            }
    }

    static public void close(JarFile jar) {
        if (jar != null) {
            try {
                jar.close();
            } catch (IOException e) {

            }
        }
    }

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

Related

  1. close(InputStream is)
  2. close(InputStream is)
  3. close(InputStream is)
  4. close(InputStream is)
  5. close(InputStream is)
  6. close(InputStream is)
  7. close(InputStream is)
  8. close(InputStream is, boolean success)
  9. close(InputStream is, OutputStream os)