File: FullBackupDataOutput.java

package info (click to toggle)
android-platform-frameworks-base 1%3A8.1.0%2Br23-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 179,108 kB
  • sloc: java: 783,264; cpp: 234,851; xml: 204,638; python: 2,837; ansic: 366; sh: 274; makefile: 43; sed: 19
file content (56 lines) | stat: -rw-r--r-- 1,561 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package android.app.backup;

import android.os.ParcelFileDescriptor;

/**
 * Provides the interface through which a {@link BackupAgent} writes entire files
 * to a full backup data set, via its {@link BackupAgent#onFullBackup(FullBackupDataOutput)}
 * method.
 */
public class FullBackupDataOutput {
    // Currently a name-scoping shim around BackupDataOutput
    private final BackupDataOutput mData;
    private final long mQuota;
    private long mSize;

    /**
     * Returns the quota in bytes for the application's current backup operation.  The
     * value can vary for each operation.
     *
     * @see BackupDataOutput#getQuota()
     */
    public long getQuota() {
        return mQuota;
    }

    /** @hide - used only in measure operation */
    public FullBackupDataOutput(long quota) {
        mData = null;
        mQuota = quota;
        mSize = 0;
    }

    /** @hide */
    public FullBackupDataOutput(ParcelFileDescriptor fd, long quota) {
        mData = new BackupDataOutput(fd.getFileDescriptor(), quota);
        mQuota = quota;
    }

    /** @hide - used only internally to the backup manager service's stream construction */
    public FullBackupDataOutput(ParcelFileDescriptor fd) {
        this(fd, -1);
    }

    /** @hide */
    public BackupDataOutput getData() { return mData; }

    /** @hide - used for measurement pass */
    public void addSize(long size) {
        if (size > 0) {
            mSize += size;
        }
    }

    /** @hide - used for measurement pass */
    public long getSize() { return mSize; }
}