use of com.dropbox.client2.exception.DropboxException in project skype-bot by toomasr.
the class DropboxDirPluginFileRepository method downloadPluginFiles.
private void downloadPluginFiles() throws DropboxException, IOException {
String rootPath = "/" + Configuration.getProperty("dropbox.plugin.dir");
Entry metadata = api.metadata(rootPath, 0, null, true, false, null);
log.info("Got a response from dropbox, list has {} entries", metadata.contents.size());
for (Entry entry : metadata.contents) {
if (!entry.fileName().endsWith(".jar")) {
continue;
}
String filepath = rootPath + "/" + entry.fileName();
log.info("Downloading file {} from dropbox", filepath);
DropboxInputStream fileStream = api.getFileStream(filepath, null);
FileUtils.copyInputStreamToFile(fileStream, new File(dir, entry.fileName()));
}
}
Aggregations