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 close(Closeable c) {
    if (c != null) {
        try {/*from  w w w .  j a v  a2  s  . c  o  m*/
            c.close();
        } catch (IOException e) {
            // do nothing
        }
    }
}

From source file:Main.java

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

From source file:Main.java

public static boolean safeClose(Closeable cb) {
    if (null != cb)
        try {/*  ww w  .  j a v a  2  s .c o m*/
            cb.close();
        } catch (IOException e) {
            return false;
        }
    return true;
}

From source file:Main.java

public static void shut(Closeable c) {
    if (c != null) {
        try {//from   w  w w. j av  a 2s .  c o m
            c.close();
        } catch (IOException ignored) {
            // ok
        }
    }
}

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 ex) {
            Log.d("Trouble closing connection", ex.getMessage());
        }
    }
}

From source file:Main.java

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

From source file:Main.java

public static void closeIO(Closeable io) {
    if (io != null) {
        try {//from w w  w  . j a va  2  s.c  o m
            io.close();
        } catch (IOException e) {
        }
        io = null;
    }
}

From source file:Main.java

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

From source file:Main.java

public static void close(Closeable obj) {
    if (obj != null) {
        try {//from w  ww  .ja  v a2  s . co m
            obj.close();
        } catch (IOException e) {
            //ignore
        }
    }
}

From source file:Main.java

private static void close(Closeable out) {
    try {// w  w w  . ja va  2s  . c  o m
        if (out != null) {
            out.close();
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}