public void write ( String key , Bitmap bitmap ) { if ( key == null || bitmap == null ) { return ; } // Add to disk cache OutputStream out = null ; try { CacheEntry cacheEntry = mDiskCache . beginEdit ( key ) ; if ( cacheEntry != null ) { out = cacheEntry . newOutputStream ( ) ; bitmap . compress ( DEFAULT_COMPRESS_FORMAT , DEFAULT_COMPRESS_QUALITY , out ) ; cacheEntry . commit ( ) ; out . close ( ) ; } } catch ( final IOException e ) { CLog . e ( LOG_TAG , "addBitmapToCache - " + e ) ; } catch ( Exception e ) { CLog . e ( LOG_TAG , "addBitmapToCache - " + e ) ; } finally { try { if ( out != null ) { out . close ( ) ; } } catch ( IOException e ) { } } }
Adds a bitmap to both memory and disk cache