Java Stream Close closeQuietly(ZipFile closeable)

Here you can find the source of closeQuietly(ZipFile closeable)

Description

close Quietly

License

Open Source License

Parameter

Parameter Description
closeable a parameter

Declaration


public static void closeQuietly(ZipFile closeable) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.Closeable;

import java.util.zip.ZipFile;

public class Main {
    /**//from   w  w  w. j a  v a  2s .c o m
     * Closes a {@link Closeable} instance (like a stream or socket)
     * by calling its {@link Closeable#close()} method
     * but ignores any occuring exceptions during the call of the method.
     * <br>
     * If the parameter is null, calling this method has no effect.
     * 
     * @param closeable the object to close
     */
    public static void closeQuietly(Closeable closeable) {
        try {
            if (closeable != null)
                closeable.close();
        } catch (Exception e) {
            // ignore
        }
    }

    /**
     * @see #closeQuietly(Closeable)
     * 
     * @param closeable
     */
    // Sadly, ZipFile does not implement Closeable before Java 7.
    public static void closeQuietly(ZipFile closeable) {
        try {
            if (closeable != null)
                closeable.close();
        } catch (Exception e) {
            // ignore
        }
    }
}

Related

  1. closeQuietly(ObjectInput... objectInputs)
  2. closeQuietly(Reader input)
  3. closeQuietly(Reader r)
  4. closeQuietly(Reader reader)
  5. closeQuietly(Writer writer)
  6. closeQuietlyWithResult(InputStream sourceInput, boolean suppressionSourceExists)
  7. closeRandomAccessFile()
  8. closeReader(BufferedReader reader)
  9. closeReader(final Reader reader)