Search in sources :

Example 1 with EnhancedResponseCache

use of com.stanfy.enroscar.net.cache.EnhancedResponseCache in project enroscar by stanfy.

the class ImageRequest method writeBitmapToDisk.

void writeBitmapToDisk(final Bitmap bitmap) throws IOException {
    EnhancedResponseCache cache = (EnhancedResponseCache) manager.getImagesResponseCache();
    OutputStream output = new FileOutputStream(cache.getLocalPath(url));
    output = manager.getBuffersPool().bufferize(output, IMAGES_BUFFER_SIZE);
    try {
        final int quality = 100;
        bitmap.compress(Bitmap.CompressFormat.PNG, quality, output);
    } finally {
        IoUtils.closeQuietly(output);
    }
}
Also used : EnhancedResponseCache(com.stanfy.enroscar.net.cache.EnhancedResponseCache) OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) FileOutputStream(java.io.FileOutputStream)

Aggregations

EnhancedResponseCache (com.stanfy.enroscar.net.cache.EnhancedResponseCache)1 FileOutputStream (java.io.FileOutputStream)1 OutputStream (java.io.OutputStream)1