Code example for BufferedOutputStream

Methods: flushclose

0
            @Override 
            public void run() { 
                if(diskCacheEnabled) {
                    BufferedOutputStream ostream = null;
                    try { 
                        ostream = new BufferedOutputStream(new FileOutputStream(new File(diskCachePath, getCacheKey(url))), 2*1024);
                        bitmap.compress(CompressFormat.JPEG, 90, ostream);
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    } finally { 
                        try { 
                            if(ostream != null) {
                                ostream.flush();
                                ostream.close();
                            } 
                        } catch (IOException e) {}
                    } 
                } 
            } 
        }); 
Experience pair programming with AI  Get Codota for Java