/**
* 根据byte数组生成图片,图片名字以当前时间作为名字
*/
public static String saveJPGFile(Context mContext, byte[] data, String key) {
if (data == null)
return null;
File mediaStorageDir = mContext
.getExternalFilesDir(Constant.cacheImage);
if (!mediaStorageDir.exists()) {
if (!mediaStorageDir.mkdirs()) {
return null;
}
}
BufferedOutputStream bos = null;
FileOutputStream fos = null;
try {
String jpgFileName = System.currentTimeMillis() + ""
+ new Random().nextInt(1000000) + "_" + key + ".jpg";
fos = new FileOutputStream(mediaStorageDir + "/" + jpgFileName);
bos = new BufferedOutputStream(fos);
bos.write(data);
return mediaStorageDir.getAbsolutePath() + "/" &