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

voidcloseQuietly(final InputStream in)
close Quietly
if (in != null) {
    try {
        in.close();
    } catch (IOException ioe) {
voidcloseQuietly(final InputStream inputStream)
Closes the InputStream if it is not null, swallowing any exceptions.
if (inputStream != null) {
    try {
        inputStream.close();
    } catch (IOException e) {
booleancloseQuietly(final Reader reader)
close Quietly
if (reader != null) {
    try {
        reader.close();
        return true;
    } catch (final Exception ex) {
        return false;
return false;
voidcloseQuietly(final ZipFile... zipFiles)
Quietly closes each of the given ZipFile s, i.e.
for (final ZipFile zipFile : zipFiles) {
    if (zipFile != null) {
        try {
            zipFile.close();
        } catch (IOException e) {
voidcloseQuietly(ImageInputStream ins)
close Quietly
if (ins != null) {
    try {
        ins.close();
    } catch (IOException e) {
        e.printStackTrace();
voidcloseQuietly(ImageReader iReader)
Unconditionally close the desired ImageReader .
if (iReader == null)
    return;
try {
    iReader.dispose();
} catch (Exception e) {
voidcloseQuietly(InputStream c)
close Quietly
try {
    c.close();
} catch (Exception e) {
voidcloseQuietly(InputStream in)
Method that will close an InputStream ignoring it if it is null and ignoring exceptions.
if (in != null) {
    try {
        in.close();
    } catch (IOException e) {
voidcloseQuietly(InputStream in)
Close a stream
try {
    if (in != null)
        in.close();
} catch (Throwable t) {
    System.out.println("[WARN] Unable to close input (e=" + t + ")");
voidcloseQuietly(InputStream input)
Unconditionally close an InputStream.
try {
    if (input != null) {
        input.close();
} catch (IOException ioe) {