Java Stream Close closeStream(Closeable closeable)

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

Description

check null and Close a stream

License

Open Source License

Parameter

Parameter Description
closeable closeable

Exception

Parameter Description
IOException an exception

Declaration

public static void closeStream(Closeable closeable) throws IOException 

Method Source Code

//package com.java2s;
/*//from www . j a v a  2  s  .c  o m
 * Copyright (C) 2010 Viettel Telecom. All rights reserved.
 * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

import java.io.Closeable;

import java.io.IOException;

public class Main {
    /**
     * check null and Close a stream
     *
     * @param closeable closeable
     * @throws IOException
     */
    public static void closeStream(Closeable closeable) throws IOException {
        if (closeable != null) {
            closeable.close();
        }
    }
}

Related

  1. closeSilently(java.util.logging.Logger log, Closeable stream)
  2. closeSilently(Object obj, Closeable stream)
  3. closeSilently(OutputStream outputStream)
  4. closeStatusFile(PrintWriter pwStatusFile)
  5. closeStream(Closeable aStream)
  6. closeStream(Closeable closeable)
  7. closeStream(Closeable stream)
  8. closeStream(Closeable stream)
  9. closeStream(Closeable... closeable)