本文整理汇总了Java中android.app.backup.BackupDataInputStream类的典型用法代码示例。如果您正苦于以下问题:Java BackupDataInputStream类的具体用法?Java BackupDataInputStream怎么用?Java BackupDataInputStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BackupDataInputStream类属于android.app.backup包,在下文中一共展示了BackupDataInputStream类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: restoreEntity
import android.app.backup.BackupDataInputStream; //导入依赖的package包/类
@Override
public void restoreEntity(final BackupDataInputStream data) {
final DAO dao = new DAO(context);
if (KEY.equals(data.getKey())) {
final BufferedReader reader = new BufferedReader(new InputStreamReader(data));
try {
dao.restoreFromReader(reader);
} catch (IOException e) {
e.printStackTrace();
}
}
dao.close();
}
示例2: readData
import android.app.backup.BackupDataInputStream; //导入依赖的package包/类
/**
* Read data from the input stream
*
* @param data the input stream
* @return the data
* @throws IOException I/O error
*/
private String readData(BackupDataInputStream data) throws IOException {
String dataS;
byte[] buf = new byte[data.size()];
data.read(buf, 0, buf.length);
ByteArrayInputStream bais = new ByteArrayInputStream(buf);
DataInputStream dis = new DataInputStream(bais);
dataS = dis.readUTF();
dis.close();
bais.close();
return dataS;
}
示例3: restoreEntity
import android.app.backup.BackupDataInputStream; //导入依赖的package包/类
/**
* Restores one entity from the restore data stream to its proper shared
* preferences file store.
*/
public void restoreEntity(BackupDataInputStream data) {
String key = data.getKey();
Log.i(TAG, "-------------------------------------------------");
Log.i(TAG, "--- restore Entity '" + key + "' size=" + data.size());
super.restoreEntity(data);
Log.i(TAG, "----- restoreEntity End");
Log.i(TAG, "-------------------------------------------------");
}
示例4: restoreEntity
import android.app.backup.BackupDataInputStream; //导入依赖的package包/类
@Override
public void restoreEntity(BackupDataInputStream data) {
String key = data.getKey();
Log.i(TAG, "-------------------------------------------------");
Log.i(TAG, "--- restore Entity '" + key + "' size=" + data.size());
if (backupKey.equals(key)) {
readBackup(data);
}
Log.i(TAG, "----- restoreEntity End");
Log.i(TAG, "-------------------------------------------------");
}
示例5: restoreEntity
import android.app.backup.BackupDataInputStream; //导入依赖的package包/类
@Override
public void restoreEntity(BackupDataInputStream data) {
byte[] buf = new byte[data.size()];
try {
data.read(buf);
ContentValues values = mAdaptor.Unserialise(buf);
mContext.getContentResolver().insert(mUri, values);
} catch (IOException e) {
Log.e("AltidroidBackup", "Unable to read backup value: " + data.getKey());
e.printStackTrace();
}
}
示例6: restoreEntity
import android.app.backup.BackupDataInputStream; //导入依赖的package包/类
@Override
public void restoreEntity(BackupDataInputStream data) {
if (mRestoreEnabled) {
super.restoreEntity(data);
}
}
示例7: restoreEntity
import android.app.backup.BackupDataInputStream; //导入依赖的package包/类
@Override
public void restoreEntity(BackupDataInputStream data) {
stopContentProvider();
super.restoreEntity(data);
}