Search in sources :

Example 1 with FileOutputStream

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;
    }
}
Also used : DataOutputStream(java.io.DataOutputStream) FileOutputStream(info.guardianproject.iocipher.FileOutputStream) IOException(java.io.IOException)

Example 2 with FileOutputStream

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;
    }
}
Also used : DataOutputStream(java.io.DataOutputStream) FileOutputStream(info.guardianproject.iocipher.FileOutputStream) IOException(java.io.IOException)

Example 3 with FileOutputStream

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();
}
Also used : FileOutputStream(info.guardianproject.iocipher.FileOutputStream) File(info.guardianproject.iocipher.File) InputStream(java.io.InputStream)

Example 4 with FileOutputStream

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();
}
Also used : Bitmap(android.graphics.Bitmap) FileOutputStream(info.guardianproject.iocipher.FileOutputStream) Intent(android.content.Intent) BufferedOutputStream(java.io.BufferedOutputStream) File(info.guardianproject.iocipher.File) IOException(java.io.IOException)

Example 5 with FileOutputStream

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();
}
Also used : FileOutputStream(info.guardianproject.iocipher.FileOutputStream) File(info.guardianproject.iocipher.File)

Aggregations

FileOutputStream (info.guardianproject.iocipher.FileOutputStream)9 File (info.guardianproject.iocipher.File)5 IOException (java.io.IOException)5 DataOutputStream (java.io.DataOutputStream)4 Bitmap (android.graphics.Bitmap)2 Intent (android.content.Intent)1 BufferedOutputStream (java.io.BufferedOutputStream)1 InputStream (java.io.InputStream)1 OmemoFingerprint (org.jivesoftware.smackx.omemo.OmemoFingerprint)1