Java Stream Close closeQuietly(ObjectInput... objectInputs)

Here you can find the source of closeQuietly(ObjectInput... objectInputs)

Description

Close the specified object input, ignoring any exceptions.

License

Apache License

Declaration

public static void closeQuietly(ObjectInput... objectInputs) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.Closeable;

import java.io.IOException;

import java.io.ObjectInput;

import java.util.zip.ZipFile;

public class Main {
    /**//ww  w. j  a v a2 s .c  om
     * Closes the specified closeable object, ignoring any exceptions.
     */
    public static void closeQuietly(Closeable... closeables) {
        for (final Closeable closeable : closeables) {
            try {
                closeable.close();
            } catch (final Exception e) {
                // Ignored
            }
        }
    }

    /**
     * Close the specified object input, ignoring any exceptions.
     */
    public static void closeQuietly(ObjectInput... objectInputs) {
        for (final ObjectInput objectInput : objectInputs) {
            try {
                objectInput.close();
            } catch (final Exception e) {
                // Ignored
            }
        }
    }

    /**
     * Same as {@link ZipFile#close()} but throwing only unchecked exceptions.
     */
    public static void closeQuietly(ZipFile... zipFiles) {
        for (final ZipFile zipFile : zipFiles) {
            try {
                zipFile.close();
            } catch (final IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}

Related

  1. closeQuietly(Object obj)
  2. closeQuietly(Object object)
  3. closeQuietly(Object object)
  4. closeQuietly(Object... o)
  5. closeQuietly(ObjectInput objectInput)
  6. closeQuietly(Reader input)
  7. closeQuietly(Reader r)
  8. closeQuietly(Reader reader)
  9. closeQuietly(Writer writer)