当前位置: 首页>>代码示例>>Java>>正文


Java DbxWriteMode.force方法代码示例

本文整理汇总了Java中com.dropbox.core.DbxWriteMode.force方法的典型用法代码示例。如果您正苦于以下问题:Java DbxWriteMode.force方法的具体用法?Java DbxWriteMode.force怎么用?Java DbxWriteMode.force使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.dropbox.core.DbxWriteMode的用法示例。


在下文中一共展示了DbxWriteMode.force方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:DropboxAPIFacade.java

示例2: call

import com.dropbox.core.DbxWriteMode; //导入方法依赖的package包/类
@Override
protected final void call(final DbxClient client, final ProgressMonitor pm) throws IOException, DbxException {
    final long fileLength = file.length();
    Uploader uploader = null;
    pm.begin(fileLength);
    final DbxWriteMode writeMode = overwrite ? DbxWriteMode.force() : DbxWriteMode.update(parent_rev);
    try (InputStream in = new FileInputStream(file)) {
        uploader = client.startUploadFile(path, writeMode, fileLength);
        final OutputStream body = uploader.getBody();
        final byte[] buffer = new byte[bufferSize];
        int read = 0;
        while ((read = in.read(buffer)) > -1) {
            body.write(buffer, 0, read);
            pm.worked(read);
        }
        uploader.finish();
    } finally {
        close(uploader);
    }
}
 
开发者ID:timezra,项目名称:dropbox-maven-plugin,代码行数:21,代码来源:FilesPut.java

示例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.toString(), uploadedFile.rev);
       } finally {
           inputStream.close();
       }
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:13,代码来源:DropboxSynchronizer.java

示例4: 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();
    }
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:12,代码来源:DropboxSynchronizer.java

示例5: call

import com.dropbox.core.DbxWriteMode; //导入方法依赖的package包/类
@Override
protected final void call(final DbxClient client, final ProgressMonitor pm) throws IOException, DbxException {
    pm.begin(1);
    final DbxWriteMode writeMode = overwrite ? DbxWriteMode.force() : DbxWriteMode.update(parent_rev);
    client.chunkedUploadFinish(path, writeMode, upload_id);
}
 
开发者ID:timezra,项目名称:dropbox-maven-plugin,代码行数:7,代码来源:CommitChunkedUpload.java


注:本文中的com.dropbox.core.DbxWriteMode.force方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。