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:marytts.util.io.FileUtils.java

public static void close(Socket socket, Closeable... closeables) {
    for (Closeable c : closeables) {
        if (c != null) {
            try {
                c.close();
            } catch (Exception ex) {
                MaryUtils.getLogger(FileUtils.class.getName()).log(Level.WARN, "Couldn't close Closeable.", ex);
            }/*  w  w  w . j a v a  2s .  c  o m*/
        }
    }
    if (socket != null) {
        try {
            socket.close();
        } catch (Exception ex) {
            MaryUtils.getLogger(FileUtils.class.getName()).log(Level.WARN, "Couldn't close Socket.", ex);
        }
    }
}

From source file:com.sat.vcse.automation.utils.shell.SSHClient.java

private static void closeSafe(final Closeable resource) {
    if (resource != null) {
        try {/*ww  w  .j  a va  2 s.  c o m*/
            resource.close();
        } catch (IOException e) {
        }
    }
}

From source file:com.apptentive.android.sdk.util.Util.java

public static void ensureClosed(Closeable stream) {
    if (stream != null) {
        try {//from  w ww .  ja  va  2  s  . c  o m
            stream.close();
        } catch (IOException e) {
            // Ignore
        }
    }
}

From source file:com.almalence.util.Util.java

public static void closeSilently(Closeable c) {
    if (c == null)
        return;/*  w  w  w  .  java 2  s .  c  o  m*/
    try {
        c.close();
    } catch (Exception t) {
    }
}

From source file:com.just.agentweb.AgentWebUtils.java

public static void closeIO(Closeable closeable) {
    try {//w  w  w . jav a  2 s  .  c  o  m

        if (closeable != null) {
            closeable.close();
        }
    } catch (Exception e) {

        e.printStackTrace();
    }

}

From source file:com.lee.sdk.utils.Utils.java

/**
 * .// www . j  a va  2  s .  co  m
 * 
 * @param closeable Closeable.
 */
public static void closeSafely(Closeable closeable) {
    try {
        if (closeable != null) {
            closeable.close();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:cd.go.contrib.elasticagents.docker.models.ExceptionMessage.java

private void closeQuietly(Closeable closeable) {
    try {/*from w  w w .  ja v  a2s.  c o m*/
        closeable.close();
    } catch (Exception e) {
        //Ignore
    }
}

From source file:org.wso2.carbon.transports.sap.idoc.DefaultIDocXMLMapper.java

private void closeStream(Closeable stream) {
    try {/*from  ww w .ja  v  a 2  s .c om*/
        stream.close();
    } catch (IOException e) {
        log.error("Error while closing the stream", e);
    }
}

From source file:com.adobe.phonegap.contentsync.Sync.java

private static void safeClose(Closeable stream) {
    if (stream != null) {
        try {/*from   w w w .  jav  a 2 s.com*/
            stream.close();
        } catch (IOException e) {
        }
    }
}

From source file:com.cs528.style.style.weather.WeatherActivity.java

private static void close(Closeable x) {
    try {//from w w  w.ja  v  a2s.c om
        if (x != null) {
            x.close();
        }
    } catch (IOException e) {
        Log.e("IOException Data", "Error occurred while closing stream");
    }
}