Example usage for android.app.backup BackupDataOutput writeEntityData

List of usage examples for android.app.backup BackupDataOutput writeEntityData

Introduction

In this page you can find the example usage for android.app.backup BackupDataOutput writeEntityData.

Prototype

public int writeEntityData(byte[] data, int size) throws IOException 

Source Link

Document

Write a chunk of data under the current entity to the backup transport.

Usage

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);/*from www .j  ava 2 s.c  o m*/
    // 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);//  w  ww. jav  a  2s.  c om
    // 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);
}