Code example for BufferedOutputStream

0
		TiBaseFile tiFile = TiFileFactory.createTitaniumFile(fileURL, false);
		File file = tiFile.getNativeFile();
 
		BufferedOutputStream bos;
		try { 
			bos = new BufferedOutputStream(new FileOutputStream(file));
			if (image.compress(CompressFormat.JPEG, (int) (compressionQuality * 100), bos)) {
				return true; 
			} 
		} catch (FileNotFoundException e) {
			return false; 
		} finally { 
	        // [MOD-309] Free up memory to work around issue in Android 
			if (image != null) {
				image.recycle();
				image = null;
			} 
			bos = null;
			ref = null;
		}