本文整理汇总了Java中com.dropbox.core.DbxEntry.isFolder方法的典型用法代码示例。如果您正苦于以下问题:Java DbxEntry.isFolder方法的具体用法?Java DbxEntry.isFolder怎么用?Java DbxEntry.isFolder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.dropbox.core.DbxEntry
的用法示例。
在下文中一共展示了DbxEntry.isFolder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isFolder
import com.dropbox.core.DbxEntry; //导入方法依赖的package包/类
@Override
public boolean isFolder(String child) throws IOException {
boolean isfolder = false;
try {
DbxEntry entry = this.dbClient.getMetadata(child);
if (entry.isFolder()) {
isfolder = true;
}
} catch (DbxException ex) {
throw new IOException("Error in folder checking");
}
return isfolder;
}
示例2: collectDropboxEntries
import com.dropbox.core.DbxEntry; //导入方法依赖的package包/类
private void collectDropboxEntries(DbxClient client, Map<String, Long> dropboxEntries, String path) throws DbxException {
WithChildren entries = client.getMetadataWithChildren(path);
for (DbxEntry entry : entries.children) {
if (entry.isFolder()) {
collectDropboxEntries(client, dropboxEntries, entry.path);
} else {
dropboxEntries.put(entry.path, entry.asFile().lastModified.getTime());
}
}
}
示例3: getChildren
import com.dropbox.core.DbxEntry; //导入方法依赖的package包/类
@Override
public List<RemoteFile> getChildren(String folderName) throws IOException {
try {
ArrayList<RemoteFile> result = new ArrayList<>();
DbxEntry.WithChildren listing = dbClient.getMetadataWithChildren(folderName);
if (listing == null) {
throw new IOException("Folder: " + folderName + " does not exist");
}
for (DbxEntry child : listing.children) {
String path = child.path;
boolean directory = child.isFolder();
long size = 0;
if (!directory) {
size = child.asFile().numBytes;
}
String base = "https://api-content.dropbox.com/1/files/dropbox";
String url = escapeURL(base, path);
RemoteFile file = new RemoteFile(path, directory, size, url);
result.add(file);
}
return result;
} catch (DbxException ex) {
throw new IOException("Dropbox folder listing error.");
}
}
示例4: downloadFolder
import com.dropbox.core.DbxEntry; //导入方法依赖的package包/类
public void downloadFolder(String remotePath, String targetPath, int depth)
throws CSPException {
try {
DbxEntry folder = client.getMetadata(remotePath);
if (folder.isFolder()) {
File remoteFolder = new File(remotePath);
File targetFolder = new File(targetPath + File.separator
+ remoteFolder.getName());
if (!targetFolder.exists()) {
targetFolder.mkdirs();
}
DbxEntry.WithChildren folderWithChildren = client
.getMetadataWithChildren(remotePath);
for (DbxEntry file : folderWithChildren.children) {
if (depth >= DropboxConstants.MAX_TREE_SEARCH_DEPTH) {
break;
}
if (file.isFile()) {
downloadFile(file.path, targetPath + "/" + folder.name
+ "/" + file.name);
} else if (file.isFolder()) {
downloadFolder(file.path, targetPath + "/"
+ folder.name, depth + 1);
}
}
}
} catch (DbxException e) {
e.printStackTrace();
}
}
示例5: _addToCache
import com.dropbox.core.DbxEntry; //导入方法依赖的package包/类
private void _addToCache(final DbxEntry entry)
{
if (entry.isFolder())
{
cacheFiles.put(entry.path, entry);
}
}
示例6: collectDropboxEntries
import com.dropbox.core.DbxEntry; //导入方法依赖的package包/类
private void collectDropboxEntries(DbxClient client, Map<String, Long> dropboxEntries, String path)
throws DbxException {
WithChildren entries = client.getMetadataWithChildren(path);
for (DbxEntry entry : entries.children) {
if (entry.isFolder()) {
collectDropboxEntries(client, dropboxEntries, entry.path);
} else {
dropboxEntries.put(entry.path, entry.asFile().lastModified.getTime());
}
}
}