Java Stream Close closeCloseableIfNotNull(Closeable fileWriter)

Here you can find the source of closeCloseableIfNotNull(Closeable fileWriter)

Description

close Closeable If Not Null

License

Open Source License

Declaration

public static void closeCloseableIfNotNull(Closeable fileWriter) 

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 closeCloseableIfNotNull(Closeable fileWriter) {
        if (fileWriter != null) {
            try {
                fileWriter.close();/*ww w .j  a v a  2 s.  c  o  m*/
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

Related

  1. closeAll(T... io)
  2. closeAllStreamsQuietly(final Closeable... closeables)
  3. closeAndRethrow(final Exception e, final Closeable... channels)
  4. closeBufferedFile(BufferedReader reader)
  5. closeBufferedReader(BufferedReader bufferedReader)
  6. closeConnection(Closeable... closes)
  7. closeDataLine(final SourceDataLine line, final AudioInputStream ais)
  8. closeDebugFile()
  9. closeEL(InputStream is)