Example usage for java.io Closeable close

List of usage examples for java.io Closeable close

Introduction

In this page you can find the example usage for java.io Closeable close.

Prototype

public void close() throws IOException;

Source Link

Document

Closes this stream and releases any system resources associated with it.

Usage

From source file:com.uphyca.galette.GAletteInstrumentation.java

/**
 * Close the resource without IOException
 *//*from w ww . j  ava2s  .  c  om*/
private static void closeQuietly(Closeable res) {
    if (res == null) {
        return;
    }
    try {
        res.close();
    } catch (IOException ignore) {
    }
}

From source file:org.dkpro.lab.Util.java

/**
 * Close a {@link Closeable} object. This method is best used in {@code finally}
 * sections.//w ww .java 2s .co  m
 *
 * @param object the object to close.
 */
public static void close(final Closeable object) {
    if (object == null) {
        return;
    }

    try {
        object.close();
    } catch (IOException e) {
        // Ignore exceptions happening while closing.
    }
}

From source file:com.ushahidi.android.app.net.MainHttpClient.java

/**
 * Closes the specified stream.// ww w.  j  a  v a  2s.  c o  m
 * 
 * @param stream The stream to close.
 */
private static void closeStream(Closeable stream) {
    if (stream != null) {
        try {
            stream.close();
        } catch (IOException e) {
            android.util.Log.e("IO", "Could not close stream", e);
        }
    }
}

From source file:com.ridgelineapps.wallpaper.photosite.TumblrUtils.java

static void closeStream(Closeable stream) {
    if (stream != null) {
        try {//ww w  . ja va  2  s  .com
            stream.close();
        } catch (IOException e) {
            android.util.Log.e(TumblrUtils.LOG_TAG, "Could not close stream", e);
        }
    }
}

From source file:com.googlecode.fascinator.storage.fedora.Fedora3.java

/**
 * A really simple wrapper on closable object to allow trivial close
 * attempts when we are unsure if they are even open.
 * // ww  w  .ja  va2  s  .  co m
 * @param toClose A Closeable Object to try closing
 */
static void close(Closeable toClose) {
    try {
        toClose.close();
    } catch (IOException ex) {
        // No worries, they may not even be open
    }
}

From source file:com.arcusys.liferay.vaadinplugin.util.ControlPanelPortletUtil.java

public static void close(Closeable closeable) {
    if (closeable == null) {
        return;//from   w w  w .  ja va  2s  .  co  m
    }
    try {
        closeable.close();
    } catch (IOException e) {
        log.warn(e);
    }
}

From source file:org.apache.jena.atlas.io.IO.java

public static void close(org.apache.jena.atlas.lib.Closeable resource) {
    resource.close();
}

From source file:edu.ucsd.library.dams.api.FileStoreServlet.java

/**
 * Close the given resource.//from w  w  w.j  a  v  a  2  s.c  om
 * @param resource The resource to be closed.
 */
private static void close(Closeable resource) {
    if (resource != null) {
        try {
            resource.close();
        } catch (IOException ignore) {
            // Ignore IOException. If you want to handle this anyway, it
            // might be useful to know that this will generally only be
            // thrown when the client aborted the request.
        }
    }
}

From source file:org.apache.jena.atlas.io.IO.java

public static void closeSilent(org.apache.jena.atlas.lib.Closeable resource) {
    try {// w  w  w  .ja  v a2 s  .  co  m
        resource.close();
    } catch (Exception ex) {
    }
}

From source file:nl.mpcjanssen.simpletask.util.Util.java

public static void closeStream(Closeable stream) {
    if (stream != null) {
        try {//from  w w  w  . jav  a2s.  co  m
            stream.close();
        } catch (IOException e) {
            Log.w(TAG, "Close stream exception", e);
        }
    }
}