Android Utililty Methods Stream Close

List of utility methods to do Stream Close

Description

The list of methods to do Stream Close are organized into topic(s).

Method

voidclose(Closeable closeable)
Closes a resource stream if the Closeable is not null, any exceptions will be swallowed.
if (closeable != null) {
    try {
        closeable.close();
    } catch (IOException e) {
voidcloseOutputStream(OutputStream os)
close Output Stream
if (os != null) {
    try {
        os.close();
    } catch (Exception e) {
voidcloseQuietly(Closeable closeable)
close Quietly
if (closeable != null) {
    try {
        closeable.close();
    } catch (IOException ioe) {
voidcloseQuitely(Closeable c)
close Quitely
if (c == null)
    return;
try {
    c.close();
} catch (IOException e) {
voidcloseStream(Closeable stream)
Closes the specified stream.
if (stream != null) {
    try {
        stream.close();
    } catch (IOException e) {
        android.util.Log.e(TAG, "Could not close stream", e);
voidcloseStream(Closeable stream)
Closes the specified stream.
if (stream != null) {
    try {
        stream.close();
    } catch (IOException e) {
        Log.e(TAG, "Could not close stream", e);
voidcloseStreams(List streams)
close Streams
if (streams == null)
    return;
for (Closeable str : streams) {
    closeQuitely(str);
voidsafeClose(OutputStream os)
Close object safely
try {
    if (os != null)
        os.close();
} catch (Exception e) {
    e.printStackTrace();