public String uploadFile(UploadFileRequest request) throws AbstractCosException {
		request.check_param();

		String localPath = request.getLocalPath();
		long fileSize = 0;
		try {
			fileSize = CommonFileUtils.getFileLength(localPath);
		} catch (Exception e) {
			throw new UnknownException(e.toString());
		}

		long suitSingleFileSize = 8 * 1024 * 1024;
		if (fileSize < suitSingleFileSize) {
			return uploadSingleFile(request);
		} else {
			UploadSliceFileRequest sliceRequest = new UploadSliceFileRequest(request);
			sliceRequest.setInsertOnly(request.getInsertOnly());
			return uploadSliceFile(sliceRequest);
		}
	}
public String uploadFile ( UploadFileRequest request ) throws AbstractCosException { request . check_param ( ) ; String localPath = request . getLocalPath ( ) ; long fileSize = 0 ; try { fileSize = CommonFileUtils . getFileLength ( localPath ) ; } catch ( Exception e ) { throw new UnknownException ( e . toString ( ) ) ; } long suitSingleFileSize = 8 * 1024 * 1024 ; if ( fileSize < suitSingleFileSize ) { return uploadSingleFile ( request ) ; } else { UploadSliceFileRequest sliceRequest = new UploadSliceFileRequest ( request ) ; sliceRequest . setInsertOnly ( request . getInsertOnly ( ) ) ; return uploadSliceFile ( sliceRequest ) ; } }
上传文件请求, 对小文件(8MB以下使用单文件上传接口）, 大文件使用分片上传接口

@param request
上传文件请求
@return JSON格式的字符串, 格式为{"code":$code, "message":"$mess"}, code为0表示成功,
其他为失败, message为success或者失败原因
@throws AbstractCosException
SDK定义的COS异常, 通常是输入参数有误或者环境问题(如网络不通)