本文整理汇总了Java中com.dropbox.core.DbxWriteMode.add方法的典型用法代码示例。如果您正苦于以下问题:Java DbxWriteMode.add方法的具体用法?Java DbxWriteMode.add怎么用?Java DbxWriteMode.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.dropbox.core.DbxWriteMode
的用法示例。
在下文中一共展示了DbxWriteMode.add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: putSingleFile
import com.dropbox.core.DbxWriteMode; //导入方法依赖的package包/类
private DbxEntry.File putSingleFile(File inputFile, String dropboxPath, DropboxUploadMode mode) throws Exception {
FileInputStream inputStream = new FileInputStream(inputFile);
DbxEntry.File uploadedFile = null;
try {
DbxWriteMode uploadMode = null;
if (mode == DropboxUploadMode.force) {
uploadMode = DbxWriteMode.force();
} else {
uploadMode = DbxWriteMode.add();
}
uploadedFile =
DropboxAPIFacade.client.uploadFile(dropboxPath,
uploadMode, inputFile.length(), inputStream);
return uploadedFile;
} finally {
inputStream.close();
}
}
示例2: uploadFile
import com.dropbox.core.DbxWriteMode; //导入方法依赖的package包/类
private void uploadFile(DbxClient client, String dropboxPath, boolean overwrite) throws DbxException, IOException {
File file = new File(contentDir + File.separator + dropboxPath);
FileInputStream inputStream = new FileInputStream(file);
try {
DbxWriteMode mode = overwrite ? DbxWriteMode.force() : DbxWriteMode.add();
DbxEntry.File uploadedFile =
client.uploadFile(dropboxPath, mode, file.length(), inputStream);
logger.debug("successfully uploaded file '{}'. New revision is '{}'", uploadedFile.toString(), uploadedFile.rev);
} finally {
inputStream.close();
}
}
示例3: uploadFile
import com.dropbox.core.DbxWriteMode; //导入方法依赖的package包/类
private void uploadFile(DbxClient client, String dropboxPath, boolean overwrite) throws DbxException, IOException {
File file = new File(contentDir + File.separator + dropboxPath);
FileInputStream inputStream = new FileInputStream(file);
try {
DbxWriteMode mode = overwrite ? DbxWriteMode.force() : DbxWriteMode.add();
DbxEntry.File uploadedFile = client.uploadFile(dropboxPath, mode, file.length(), inputStream);
logger.debug("Successfully uploaded file '{}'. New revision is '{}'.", uploadedFile, uploadedFile.rev);
} finally {
inputStream.close();
}
}