Java Stream Close closeStream(Closeable stream)

Here you can find the source of closeStream(Closeable stream)

Description

Close IO stream safely.

License

Open Source License

Parameter

Parameter Description
stream a parameter

Declaration

public static void closeStream(Closeable stream) 

Method Source Code

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

import java.io.Closeable;

import java.io.IOException;

public class Main {

    public static void closeStream(Closeable stream) {
        try {/* w  ww .j  a  va2s  . c  o  m*/
            if (stream != null) {
                stream.close();
            }
        } catch (IOException e) {
            System.out.println("Close IO stream failure.");
            e.printStackTrace();
        }
    }
}

Related

  1. closeSilently(OutputStream outputStream)
  2. closeStatusFile(PrintWriter pwStatusFile)
  3. closeStream(Closeable aStream)
  4. closeStream(Closeable closeable)
  5. closeStream(Closeable closeable)
  6. closeStream(Closeable stream)
  7. closeStream(Closeable... closeable)
  8. closeStream(Closeable... streams)
  9. closeStream(FileInputStream in)