code: public static void serialize(File file, SerializableObject object, @NonNull EncryptionKey encryptionKey) throws IOException {
  		ByteArrayOutputStream bos = null;
  		DataOutputStream dos = null;
  		try {
  			bos = new ByteArrayOutputStream();
  			dos = new DataOutputStream(bos);
  			object.writeExternal(dos);
  			final byte[] unencryptedBytes = bos.toByteArray();
  			final byte[] encryptedBytes = Encryptor.encrypt(encryptionKey, unencryptedBytes);
  			Util.writeAtomically(file, encryptedBytes);
  		} catch (Exception e) {
  			throw new IOException(e);
  		} finally {
  			Util.ensureClosed(bos);
  			Util.ensureClosed(dos);
  		}
  	}
docs: Writes an object ot an encrypted file