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

voidclose(Appendable output)
Close if possible
if (output instanceof Closeable)
    ((Closeable) output).close();
Appendableclose(Appendable sb, String comp)
_more_
try {
    sb.append("</");
    sb.append(comp);
    sb.append(">");
} catch (IOException ioe) {
    throw new RuntimeException(ioe);
return sb;
...
voidclose(BufferedReader br)
close
br.close();
voidclose(BufferedReader br)
Close.
if (br == null) {
    return;
try {
    br.close();
} catch (IOException e) {
    throw e;
voidclose(BufferedWriter bufferedWriter)
close
try {
    if (bufferedWriter != null) {
        bufferedWriter.flush();
        bufferedWriter.close();
} catch (IOException e) {
voidclose(ClassLoader cl)
close
if (cl instanceof Closeable) {
    ((Closeable) cl).close();
voidclose(Closeable bufferedInputStream)
close
if (bufferedInputStream != null) {
    try {
        bufferedInputStream.close();
    } catch (IOException e) {
        e.printStackTrace();
voidclose(Closeable closeable, boolean ignoreException)
close
if (closeable == null) {
    return;
try {
    closeable.close();
} catch (IOException e) {
    if (ignoreException == false) {
        throw new UncheckedIOException(e);
...
voidclose(Closeable closeable, boolean swallowIOException)
close
if (closeable != null) {
    try {
        closeable.close();
    } catch (IOException e) {
        if (!swallowIOException) {
            throw e;
voidclose(Closeable closeable, Logger logger)
close
if (closeable == null) {
    return;
try {
    closeable.close();
} catch (IOException e) {
    logger.error("Error closing closeable", e);