use of info.guardianproject.iocipher.FileOutputStream in project Zom-Android by zom.
the class IOCipherOmemoStore method writeInt.
private void writeInt(File target, int i) throws IOException {
if (target == null) {
throw new IOException("Could not write integer to null-path.");
}
FileHierarchy.createFile(target);
IOException io = null;
DataOutputStream out = null;
try {
out = new DataOutputStream(new FileOutputStream(target));
out.writeInt(i);
} catch (IOException e) {
io = e;
} finally {
if (out != null) {
out.close();
}
}
if (io != null) {
throw io;
}
}
use of info.guardianproject.iocipher.FileOutputStream in project Zom-Android by zom.
the class IOCipherOmemoStore method writeLong.
private void writeLong(File target, long i) throws IOException {
if (target == null) {
throw new IOException("Could not write long to null-path.");
}
FileHierarchy.createFile(target);
IOException io = null;
DataOutputStream out = null;
try {
out = new DataOutputStream(new FileOutputStream(target));
out.writeLong(i);
} catch (IOException e) {
io = e;
} finally {
if (out != null) {
out.close();
}
}
if (io != null) {
throw io;
}
}
use of info.guardianproject.iocipher.FileOutputStream in project Zom-Android by zom.
the class SecureMediaStore method copyToVfs.
public static void copyToVfs(java.io.File sourceFile, String targetPath) throws IOException {
// create the target directories tree
mkdirs(targetPath);
// copy
java.io.InputStream fis = null;
fis = new java.io.FileInputStream(sourceFile);
FileOutputStream fos = new FileOutputStream(new File(targetPath), false);
IOUtils.copyLarge(fis, fos);
fos.close();
fis.close();
}
use of info.guardianproject.iocipher.FileOutputStream in project Zom-Android by zom.
the class SecureCameraActivity method onPictureTaken.
@Override
public void onPictureTaken(final byte[] data, Camera camera) {
try {
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(new File(filename)));
out.write(data);
out.flush();
out.close();
if (thumbnail != null) {
Bitmap thumbnailBitmap = getThumbnail(getContentResolver(), filename);
FileOutputStream fos = new FileOutputStream(thumbnail);
thumbnailBitmap.compress(Bitmap.CompressFormat.JPEG, 90, fos);
}
Intent intent = new Intent();
intent.putExtra(FILENAME, filename);
intent.putExtra(THUMBNAIL, thumbnail);
intent.putExtra(MIMETYPE, "image/*");
setResult(Activity.RESULT_OK, intent);
finish();
} catch (Exception e) {
e.printStackTrace();
setResult(Activity.RESULT_CANCELED);
finish();
}
finish();
}
use of info.guardianproject.iocipher.FileOutputStream in project Zom-Android by zom.
the class SecureMediaStore method copyToVfs.
public static void copyToVfs(byte[] buf, String targetPath) throws IOException {
File file = new File(targetPath);
FileOutputStream out = new FileOutputStream(file);
out.write(buf);
out.close();
}
Aggregations