FileDocCategorySizeDatePackage
AbsoluteFileBackupHelper.javaAPI DocAndroid 5.1 API2372Thu Mar 12 22:22:10 GMT 2015android.app.backup

AbsoluteFileBackupHelper

public class AbsoluteFileBackupHelper extends FileBackupHelperBase implements BackupHelper
Like FileBackupHelper, but takes absolute paths for the files instead of subpaths of getFilesDir()
hide

Fields Summary
private static final String
TAG
private static final boolean
DEBUG
android.content.Context
mContext
String[]
mFiles
Constructors Summary
public AbsoluteFileBackupHelper(android.content.Context context, String files)
Construct a helper for backing up / restoring the files at the given absolute locations within the file system.

param
context
param
files


                                
         
        super(context);

        mContext = context;
        mFiles = files;
    
Methods Summary
public voidperformBackup(android.os.ParcelFileDescriptor oldState, BackupDataOutput data, android.os.ParcelFileDescriptor newState)
Based on oldState, determine which of the files from the application's data directory need to be backed up, write them to the data stream, and fill in newState with the state as it exists now.

        // use the file paths as the keys, too
        performBackup_checked(oldState, data, newState, mFiles, mFiles);
    
public voidrestoreEntity(BackupDataInputStream data)
Restore one absolute file entity from the restore stream

        if (DEBUG) Log.d(TAG, "got entity '" + data.getKey() + "' size=" + data.size());
        String key = data.getKey();
        if (isKeyInList(key, mFiles)) {
            File f = new File(key);
            writeFile(f, data);
        }