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 closeSilently(Closeable c) {
    if (c == null)
        return;//w  ww  . java 2  s.c  o  m
    try {
        c.close();
    } catch (IOException t) {
        Log.w(TAG, "close fail ", t);
    }
}

From source file:Main.java

public static void closeQuietly(final Closeable closeable) {
    if (closeable == null) {
        return;//from ww  w  .  j a  v  a 2 s  .c  o m
    }

    try {
        closeable.close();
    } catch (final IOException e) {
        // ignore
    }
}

From source file:Main.java

public static void closeIO(Closeable... closeables) {
    if (closeables == null)
        return;/*from ww  w .ja  va  2  s. co  m*/
    for (Closeable closeable : closeables) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

From source file:Main.java

public static void closeIO(Closeable... closeables) {
    for (Closeable closeable : closeables) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (IOException e) {
                // no-op
            }/*w ww . j ava 2  s  . c  om*/
        }
    }
}

From source file:Main.java

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

From source file:Main.java

public static void closeIO(Closeable... closeables) {
    if (closeables == null) {
        return;//  w w  w. j  a  v  a  2 s . co  m
    }
    for (Closeable closeable : closeables) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

From source file:Main.java

public static void CloseIO(Closeable... closeables) {
    if (closeables == null)
        return;/*from   w ww  .j  a  v  a 2s .  co m*/

    for (Closeable closeable : closeables) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

From source file:Main.java

private static void silentClose(Closeable closeable) {
    if (closeable == null) {
        return;//ww  w.  j a va2  s.c  om
    }
    try {
        closeable.close();
    } catch (IOException ignored) {
    }
}

From source file:Main.java

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

From source file:org.eclipse.recommenders.utils.IOUtils.java

public static boolean closeQuietly(Closeable s) {
    if (s == null) {
        return true;
    }/*  w ww  . j  av  a  2s  .  c  o m*/
    try {
        s.close();
        return true;
    } catch (IOException e) {
        System.err.printf("Failed to close resource '%s'. Caught exception printed below.\n", s);
        e.printStackTrace();
        return false;
    }
}