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 boolean close(Closeable... closeables) {
    for (Closeable closeable : closeables) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (IOException e) {
                return false;
            }/* w w  w.  j a v a  2  s . co  m*/
        }
    }
    return true;
}

From source file:Main.java

public static void closeIOQuietly(Closeable... closeables) {
    if (closeables == null)
        return;//from  w  w w. j  av a2 s. com
    for (Closeable closeable : closeables) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (IOException ignored) {
            }
        }
    }
}

From source file:Main.java

/**
 * Gracefully closes a specific stream.//  w ww  .  j  ava  2s . co m
 *
 * @param stream
 *         The stream, which should be closed, as an instance of the type {@link Closeable}
 */
public static void close(@Nullable final Closeable stream) {
    if (stream != null) {
        try {
            stream.close();
        } catch (IOException e) {
            // No need to handle
        }
    }
}

From source file:org.apache.streams.s3.S3PersistReaderTask.java

private static void closeSafely(String file, Closeable closeable) {
    try {/*from   w  ww. j  av a  2  s  . c o m*/
        closeable.close();
    } catch (Exception ex) {
        LOGGER.error("There was an issue closing file: {}", file);
    }
}

From source file:Main.java

public static void closeSilently(Closeable closeable) {
    if (closeable != null) {
        try {// www . j a  v a2 s .  c o  m
            closeable.close();
        } catch (Exception ignored) {
        }
    }
}

From source file:Main.java

public static void closeSilently(Closeable c) {
    if (c == null)
        return;// w  w w.  j  a v a 2s .c o m
    try {
        c.close();
    } catch (Throwable t) {
        Log.w(TAG, "fail to close", t);
    }
}

From source file:Main.java

public static void closeQuietly(Closeable c) {
    if (c == null)
        return;/*from   w ww . j  ava2  s  .  co  m*/

    try {
        c.close();
    } catch (Exception e) {
    }
}

From source file:Main.java

/**
 * @param closeable/*from   w w w . j a  v a2  s .c o m*/
 */
public static void closeSilently(Closeable closeable) {

    if (closeable == null)
        return;

    try {
        closeable.close();
    } catch (Exception e) {
        // Do nothing
    }
}

From source file:Main.java

public static void closeIOQuietly(final Closeable... closeables) {
    if (closeables == null)
        return;//from w ww . jav  a 2  s  .  c  om
    for (Closeable closeable : closeables) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (IOException ignored) {
            }
        }
    }
}

From source file:Main.java

public static void closeIOQuietly(Closeable... closeables) {
    if (closeables == null) {
        return;/*from  w  w w  . j  av a 2s  .  c o m*/
    }
    for (Closeable closeable : closeables) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (IOException ignored) {
            }
        }
    }
}