List of usage examples for android.app.backup BackupDataOutput writeEntityHeader
public int writeEntityHeader(String key, int dataSize) throws IOException
From source file:com.csipsimple.backup.SipProfilesHelper.java
private void writeData(BackupDataOutput data, String value) throws IOException { // Create buffer stream and data output stream for our data ByteArrayOutputStream bufStream = new ByteArrayOutputStream(); DataOutputStream outWriter = new DataOutputStream(bufStream); // Write structured data outWriter.writeUTF(value);// w w w. j a v a 2 s .c om // Send the data to the Backup Manager via the BackupDataOutput byte[] buffer = bufStream.toByteArray(); int len = buffer.length; data.writeEntityHeader(ACCOUNTS_BACKUP_KEY, len); data.writeEntityData(buffer, len); }
From source file:com.csipsimple.backup.SipSharedPreferencesHelper.java
private void writeData(BackupDataOutput data, String value) throws IOException { // Create buffer stream and data output stream for our data ByteArrayOutputStream bufStream = new ByteArrayOutputStream(); DataOutputStream outWriter = new DataOutputStream(bufStream); // Write structured data outWriter.writeUTF(value);// ww w. j a v a2 s. c o m // Send the data to the Backup Manager via the BackupDataOutput byte[] buffer = bufStream.toByteArray(); int len = buffer.length; data.writeEntityHeader(SETTINGS_BACKUP_KEY, len); data.writeEntityData(buffer, len); }