Example usage for java.io Closeable close

List of usage examples for java.io Closeable close

Introduction

In this page you can find the example usage for java.io Closeable close.

Prototype

public void close() throws IOException;

Source Link

Document

Closes this stream and releases any system resources associated with it.

Usage

From source file:Main.java

public static void closeIO(Closeable... closeables) throws IOException {
    if (null == closeables || closeables.length <= 0) {
        return;/*from   w w w .j  av a2 s. com*/
    }
    for (Closeable cb : closeables) {
        if (null != cb) {
            cb.close();
        }
    }
}

From source file:Main.java

public static void close(Closeable stream) throws IOException {

    if (stream != null) {
        stream.close();
        stream = null;//from w  w  w  .  j  a v a 2  s  .  c o  m
    }
}

From source file:Main.java

/**
 * Silent close a closable object.//from   w  w  w.  j av  a  2s .com
 * @param o
 */
public static void silentClose(Closeable o) {
    if (o != null) {
        try {
            o.close();
        } catch (IOException e) {
            //            msLogger.debug(ApplicationUtil.class.getName() + "#slientClose() error occurred!!!", e);
        }
    }
}

From source file:Main.java

private static void close(Closeable dest) {
    if (dest != null) {
        try {//from w  w  w  .j  a  va2  s  .  c o  m
            dest.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

From source file:Main.java

public static void closeStream(Closeable stream) {
    try {/*from  ww w  .  j  ava 2 s  .  com*/
        if (stream != null)
            stream.close();
    } catch (IOException e) {

    }
}

From source file:Main.java

private static void closeStream(Closeable close) {
    if (close != null) {
        try {/* w  w  w.  j  a v a  2s.  c  o  m*/
            close.close();
        } catch (IOException e) {
        }
    }
}

From source file:Main.java

public static void closeThrowException(Closeable close) throws IOException {
    if (close != null) {
        close.close();
    }//from w  w w  .  j av a2 s .  com
}

From source file:Main.java

public static void closeQuietly(Closeable c) {
    if (c == null)
        return;/*from  www.  jav  a 2  s  .  c  o  m*/
    try {
        c.close();
    } catch (Throwable ignored) {
    }
}

From source file:Main.java

public static final void closeStream(Closeable stream) {
    if (stream != null)
        try {// ww w .  j a va 2 s.c o m
            stream.close();
            stream = null;
        } catch (IOException e) {
            e.printStackTrace();
        }
}

From source file:Main.java

public static void close(Closeable c) {
    if (c != null) {
        try {/* ww  w.  j  a v  a  2  s.  c  o  m*/
            c.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}