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


Java OSS类代码示例

本文整理汇总了Java中com.alibaba.sdk.android.oss.OSS的典型用法代码示例。如果您正苦于以下问题:Java OSS类的具体用法?Java OSS怎么用?Java OSS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OSS类属于com.alibaba.sdk.android.oss包,在下文中一共展示了OSS类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: upload

import com.alibaba.sdk.android.oss.OSS; //导入依赖的package包/类
/**
 * 上传的最终方法,成功返回一个路径
 * @param objkey 上传上去后,在服务器上的独立的KEY
 * @param path 需要上传的文件的路劲
 * @return 返回一个存储的地址
 */
private static String upload(String objkey, String path) {

    // 构造上传请求
    PutObjectRequest request = new PutObjectRequest(BUCKET_NAME,objkey, path);
    try {
        // 初始化上传的Client
        OSS ossClient = getClient();
        // 开始同步上传
        PutObjectResult result = ossClient.putObject(request);
        // 得到一个外网访问的地址
        String url = ossClient.presignPublicObjectURL(BUCKET_NAME, objkey);
        Log.d("PublicObjectUrl", url);
        return url;
    } catch (Exception e) {
        // 如果有异常则返回空
        return null;
    }
}
 
开发者ID:FZZFVII,项目名称:pipe,代码行数:25,代码来源:UploadHelper.java

示例2: OssSamples

import com.alibaba.sdk.android.oss.OSS; //导入依赖的package包/类
public OssSamples(OSS client, RequestWrapper wrapper) {
    this.oss = client;
    this.testBucket = wrapper.getTestBucket();
    this.testObject = wrapper.getTestObject();
    this.uploadFilePath = wrapper.getUploadFilePath();
    this.wrapper = wrapper;
    if(wrapper.getResponseListener() != null) {
        responseListener = wrapper.getResponseListener();
    }
}
 
开发者ID:wangdong20,项目名称:OSSSDK,代码行数:11,代码来源:OssSamples.java

示例3: getClient

import com.alibaba.sdk.android.oss.OSS; //导入依赖的package包/类
private static OSS getClient() {
    // 明文设置secret的方式建议只在测试时使用,更多鉴权模式请参考后面的`访问控制`章节
    OSSCredentialProvider credentialProvider = new OSSPlainTextAKSKCredentialProvider(
            "LTAIPoHCWLunTeWC", "BgvBOTkXGKhw0Cyq90T11ruUw9GL40 ");
    return new OSSClient(Factory.app(), ENDPOINT, credentialProvider);
}
 
开发者ID:FZZFVII,项目名称:pipe,代码行数:7,代码来源:UploadHelper.java

示例4: UploadFile

import com.alibaba.sdk.android.oss.OSS; //导入依赖的package包/类
public UploadFile(OSS client, String bucket, String object, String uploadFilePath) {
    this.oss = client;
    this.bucket = bucket;
    this.object = object;
    this.uploadFilePath = uploadFilePath;
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:7,代码来源:UploadFile.java

示例5: MultipartUploadSamples

import com.alibaba.sdk.android.oss.OSS; //导入依赖的package包/类
public MultipartUploadSamples(OSS client, RequestWrapper wrapper) {
    super(client, wrapper);
}
 
开发者ID:wangdong20,项目名称:OSSSDK,代码行数:4,代码来源:MultipartUploadSamples.java

示例6: GetObjectSamples

import com.alibaba.sdk.android.oss.OSS; //导入依赖的package包/类
public GetObjectSamples(OSS client, RequestWrapper wrapper) {
    super(client, wrapper);
}
 
开发者ID:wangdong20,项目名称:OSSSDK,代码行数:4,代码来源:GetObjectSamples.java

示例7: ResuambleUploadSamples

import com.alibaba.sdk.android.oss.OSS; //导入依赖的package包/类
public ResuambleUploadSamples(OSS client, RequestWrapper wrapper) {
    super(client, wrapper);
}
 
开发者ID:wangdong20,项目名称:OSSSDK,代码行数:4,代码来源:ResuambleUploadSamples.java

示例8: PutObjectSamples

import com.alibaba.sdk.android.oss.OSS; //导入依赖的package包/类
public PutObjectSamples(OSS client, RequestWrapper wrapper) {
    super(client, wrapper);
}
 
开发者ID:wangdong20,项目名称:OSSSDK,代码行数:4,代码来源:PutObjectSamples.java

示例9: ManageObjectSamples

import com.alibaba.sdk.android.oss.OSS; //导入依赖的package包/类
/**
 * @param client
 * @param wrapper The RequestWrapper's uploadFilePath can be null.
 */
public ManageObjectSamples(OSS client, RequestWrapper wrapper) {
    super(client, wrapper);
}
 
开发者ID:wangdong20,项目名称:OSSSDK,代码行数:8,代码来源:ManageObjectSamples.java


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