本文整理汇总了Java中com.google.android.gms.drive.MetadataBuffer.get方法的典型用法代码示例。如果您正苦于以下问题:Java MetadataBuffer.get方法的具体用法?Java MetadataBuffer.get怎么用?Java MetadataBuffer.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.drive.MetadataBuffer
的用法示例。
在下文中一共展示了MetadataBuffer.get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readRelativeDir
import com.google.android.gms.drive.MetadataBuffer; //导入方法依赖的package包/类
void readRelativeDir(Context context, Icons.IconType iconType, Icons.IconState state, MetadataBuffer children) {
for (int i = 0; i < children.getCount(); ++i) {
Metadata d = children.get(i);
if (!d.isFolder()) {
DriveFile file = Drive.DriveApi.getFile(mClient, d.getDriveId());
DriveApi.ContentsResult contentsResult =
file.openContents(mClient, DriveFile.MODE_READ_ONLY, null).await();
if (!contentsResult.getStatus().isSuccess()) {
continue;
}
Contents r = contentsResult.getContents();
Icons.saveIcon(context, d.getTitle(), iconType, state, r.getInputStream());
}
}
children.close();
}
示例2: readIconsDir
import com.google.android.gms.drive.MetadataBuffer; //导入方法依赖的package包/类
void readIconsDir(Context context, MetadataBuffer children) {
for (int i = 0; i < children.getCount(); ++i) {
Metadata d = children.get(i);
if (!d.isFolder())
continue;
boolean found = false;
for (Icons.IconType iconType : Icons.IconType.values()) {
for (Icons.IconState state : Icons.IconState.values()) {
String relativePath = iconType.name() + state.name();
if (d.getTitle().equals(relativePath)) {
DriveFolder iconsDir = Drive.DriveApi.getFolder(mClient, d.getDriveId());
DriveApi.MetadataBufferResult resultIconsDir = iconsDir.listChildren(mClient).await();
if (!resultIconsDir.getStatus().isSuccess()) {
continue;
}
readRelativeDir(context, iconType, state, resultIconsDir.getMetadataBuffer());
found = true;
break;
}
}
if (found)
break;
}
}
children.close();
}
示例3: doInBackground
import com.google.android.gms.drive.MetadataBuffer; //导入方法依赖的package包/类
@Override
protected Boolean doInBackground(Void... params) {
// Create folder
DriveFolder backupDir = Drive.DriveApi.getFolder(mClient, driveId);
DriveApi.MetadataBufferResult result = backupDir.listChildren(mClient).await();
if (!result.getStatus().isSuccess()) {
// We failed, stop the task and return.
return false;
}
MetadataBuffer b = null;
try {
b = result.getMetadataBuffer();
for (int i = 0; i < b.getCount(); ++i) {
Metadata d = b.get(i);
if (d.getTitle().equals("scenes.json")) {
scenes = readFile(d);
} else if (d.getTitle().equals("groups.json")) {
groups = readFile(d);
} else if (d.getTitle().equals("devices.json")) {
devices = readFile(d);
} else if (d.isFolder() && d.getTitle().equals("icons")) {
DriveFolder iconsDir = Drive.DriveApi.getFolder(mClient, d.getDriveId());
DriveApi.MetadataBufferResult resultIconsDir = iconsDir.listChildren(mClient).await();
if (!resultIconsDir.getStatus().isSuccess()) {
// We failed, stop the task and return.
continue;
}
readIconsDir(context, resultIconsDir.getMetadataBuffer());
}
}
} finally {
if (b != null) b.close();
}
return true;
}