Java InputStream Close close(InputStream is)

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

Description

close

License

Apache License

Declaration

public static void close(InputStream is) 

Method Source Code


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

import java.io.*;

public class Main {

    public static void close(Reader reader) {
        try {/*from w  w w  .ja v  a2s  .  co  m*/
            if (reader != null)
                reader.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

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

    public static void close(OutputStream os) {
        try {
            if (os != null) {
                os.flush();
                os.close();
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

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, boolean success)
  7. close(InputStream is, OutputStream os)
  8. forceClose(Closeable stream)
  9. forceClosed(InputStream stream)