Java Utililty Methods Stream Close

List of utility methods to do Stream Close

Description

The list of methods to do Stream Close are organized into topic(s).

Method

voidcloseAll()
close All
for (FileWriter fw : writers.values()) {
    try {
        fw.close();
    } catch (IOException e) {
        e.printStackTrace();
voidcloseAll()
close All
closeDribbleFile();
closeDribbleFile2();
closeDebugFile();
closeWarningFile();
voidcloseAll(Collection closeables)
Closes given Collection collection of AutoCloseable closeables .
closeAll(closeables.toArray(new AutoCloseable[closeables.size()]));
voidcloseAll(Exception firstEx, Closeable... objects)
Same as closeAll(Closeable...) but allows passing an initial exception, when one may have been thrown earlier during a shutdown procedure.
for (Closeable c : objects) {
    if (c == null) {
        continue;
    try {
        c.close();
    } catch (Exception e) {
        if (firstEx == null) {
...
voidcloseAll(Iterable closeables)
close All
IOException caught = null;
for (Closeable closeable : closeables) {
    try {
        if (closeable != null)
            closeable.close();
    } catch (IOException e) {
        if (caught == null)
            caught = e;
...
voidcloseAll(T... io)
close All
for (Closeable temp : io) {
    try {
        if (null != temp) {
            temp.close();
    } catch (Exception e) {
voidcloseAllStreamsQuietly(final Closeable... closeables)
Closes a list of Closeable objects quietly.
The specified list may contain objects with null null values.
for (Closeable aCloseable : closeables) {
    closeStreamQuietly(aCloseable);
voidcloseAndRethrow(final Exception e, final Closeable... channels)
close And Rethrow
closeQuietly(channels);
throw new IllegalStateException(e);
voidcloseBufferedFile(BufferedReader reader)
close Buffered File
try {
    if (reader != null)
        reader.close();
} catch (IOException e) {
    throw new RuntimeException("Cannot close file. " + e.getMessage());
voidcloseBufferedReader(BufferedReader bufferedReader)
close Buffered Reader
if (null != bufferedReader) {
    try {
        bufferedReader.close();
    } catch (IOException e) {