Code example for BackupDataOutput

Methods: writeEntityData, writeEntityHeader

0
        // Doing copy 
        ByteArrayOutputStream dataCopy = copyTableAsBytes();
        if (dataCopy != null) {
            try { 
                byte[] dataBytes = dataCopy.toByteArray();
                data.writeEntityHeader(backupKey, dataBytes.length);
                data.writeEntityData(dataBytes, dataBytes.length);
                Log.i(TAG, "performBackup Entity '" + backupKey + "' size=" + dataBytes.length);
            } catch (IOException e) {
                Log.e(TAG, "Error during Backup Data : " + e.getMessage(), e);
            } 
        } 
 
        // Write State 
        // FileOutputStream outstream = new 
        // FileOutputStream(newState.getFileDescriptor()); 
        // DataOutputStream out = new DataOutputStream(outstream); 
        // try { 
        // long modified = System.currentTimeMillis(); // 
        // mDataFile.lastModified(); 
        // out.writeLong(modified);