private final String mMainFileName = StorageManagerEx.getExternalStoragePath() + "/fac_test_main_cam.jpg";
private final String mSubFileName = StorageManagerEx.getExternalStoragePath() + "/fac_test_sub_cam.jpg";
private void createFileWithByte(byte[] bytes, int cameraId) {
// TODO Auto-generated method stub
Log.i(TAG, "createFileWithByte cameraId = " + cameraId);
File file = new File((cameraId == mMainCameraID) ? mMainFileName : mSubFileName);
FileOutputStream outputStream = null;
BufferedOutputStream bufferedOutputStream = null;
try {
if (file.exists()) {
file.delete();
}
file.createNewFile();
outputStream = new FileOutputStream(file);
bufferedOutputStream = new BufferedOutputStream(outputStream);
bufferedOutputStream.write(bytes);
bufferedOutputStream.flush();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (bufferedOutputStream != null) {
try {
bufferedOutputStream.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
}
private final String mSubFileName = StorageManagerEx.getExternalStoragePath() + "/fac_test_sub_cam.jpg";
private void createFileWithByte(byte[] bytes, int cameraId) {
// TODO Auto-generated method stub
Log.i(TAG, "createFileWithByte cameraId = " + cameraId);
File file = new File((cameraId == mMainCameraID) ? mMainFileName : mSubFileName);
FileOutputStream outputStream = null;
BufferedOutputStream bufferedOutputStream = null;
try {
if (file.exists()) {
file.delete();
}
file.createNewFile();
outputStream = new FileOutputStream(file);
bufferedOutputStream = new BufferedOutputStream(outputStream);
bufferedOutputStream.write(bytes);
bufferedOutputStream.flush();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (bufferedOutputStream != null) {
try {
bufferedOutputStream.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
}