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:Main.java

public static void closeQuietly(Closeable closeable) {
    if (closeable == null)
        return;//from   w w w.  j  a  va  2 s .c  om
    try {
        closeable.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void close(Closeable paramCloseable) {
    if (paramCloseable != null) {
    }/*from  w w  w  .ja  v a2  s  .co m*/
    try {
        paramCloseable.close();
        return;
    } catch (Exception localException) {
    }
}

From source file:Main.java

/**
 * Closes the specified stream.//from w w w.  j  a  v a2  s.  co m
 *
 * @param stream The stream to close.
 */
public static void closeStream(final Closeable stream) {
    if (stream != null) {
        try {
            stream.close();
        } catch (final IOException e) {
            Log.e(TAG, "Could not close stream " + e);
        }
    }
}

From source file:Main.java

public static boolean close(Closeable closeable) {
    if (closeable != null) {
        try {//  ww  w  .j av a  2  s  .  c om
            closeable.close();
            return true;
        } catch (IOException e) {
        }
    }
    return false;
}

From source file:Main.java

public static boolean closeStream(Closeable paramCloseable) {
    if (paramCloseable != null)
        try {//from ww  w .  j  a v  a  2s  . c  om
            paramCloseable.close();
            return true;
        } catch (IOException localIOException) {
            localIOException.printStackTrace();
        }
    return false;
}

From source file:Main.java

public static void closeSafely(Closeable closeable) {
    try {/*from w w  w . j av a2 s. c  o  m*/
        if (closeable != null) {
            closeable.close();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void close(Closeable closeable) {
    if (closeable != null)
        try {// w  w  w .  ja  v  a2 s  . co  m
            closeable.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
}

From source file:Main.java

public static void closeQuietly(Closeable closable) {
    if (closable != null) {
        try {//from  ww  w . jav a2s.c  om
            closable.close();
        } catch (IOException ignored) {
        }
    }
}

From source file:Main.java

public static void closeQuietly(Closeable closeable) {
    try {//from w w w .j a v  a 2s.co m
        if (closeable != null) {
            closeable.close();
        }
    } catch (IOException ioe) {
        // ignore
    }
}

From source file:Main.java

private static void close(Closeable closeable) {
    if (closeable != null)
        try {/*w  w  w.j a v a  2 s. c o  m*/
            closeable.close();
        } catch (IOException ignored) {
        }
}