Code example for BufferedOutputStream

Methods: close, flush

0
 
	public boolean save(String path) {
		boolean flag = false;
		File sketchImgFile = new File(path + ".jpg");
		try { 
			BufferedOutputStream bos = new BufferedOutputStream(
					new FileOutputStream(sketchImgFile));
			//bitmap = Bitmap.createScaledBitmap(bitmap, 480, 480, false); 
			bitmap.compress(Bitmap.CompressFormat.JPEG, 80, bos);
			bos.flush();
			bos.close();
			flag = true;
		} catch (Exception e) {
			e.printStackTrace();
		} 
		return flag;
	} 
 
	public void setMod(int mod) {
		this.mod = mod;
	}