Ventrix’s Code Folds

Closing a stream

by ventrix on Dec.10, 2008, under android, j2ee, j2me, j2se, java

/**
          * Closes the specified stream.
          *
          * @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);
                 }
             } 

Use it like: closeStream(in);

No comments for this entry yet...

Comments are closed.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

Archives

All entries, chronologically...