七牛---关于JAVA SDK的各种Demo
来源:互联网 发布:荣耀三九年 知乎 编辑:程序博客网 时间:2024/05/22 10:31
具体可以参考七牛JAVA SDK的源码以及官网使用文档:
https://github.com/qiniu/java-sdk
http://developer.qiniu.com/docs/v6/sdk/java-sdk.html
简单上传
import com.qiniu.util.Auth;import java.io.IOException;import com.qiniu.common.QiniuException;import com.qiniu.http.Response;import com.qiniu.storage.UploadManager;public class UploadDemo { //设置好账号的ACCESS_KEY和SECRET_KEY String ACCESS_KEY = "Access_Key"; String SECRET_KEY = "Secret_Key"; //要上传的空间 String bucketname = "Bucket_Name"; //上传到七牛后保存的文件名 String key = "my-java.png"; //上传文件的路径 String FilePath = "/.../..."; //密钥配置 Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); //创建上传对象 UploadManager uploadManager = new UploadManager(); //简单上传,使用默认策略,只需要设置上传的空间名就可以了 public String getUpToken(){ return auth.uploadToken(bucketname); } public void upload() throws IOException{ try { //调用put方法上传 Response res = uploadManager.put(FilePath, null, getUpToken()); //打印返回的信息 System.out.println(res.bodyString()); } catch (QiniuException e) { Response r = e.response; // 请求失败时打印的异常的信息 System.out.println(r.toString()); try { //响应的文本信息 System.out.println(r.bodyString()); } catch (QiniuException e1) { //ignore } } } public static void main(String args[]) throws IOException{ new UploadDemo().upload(); }}
覆盖上传
import java.io.IOException;import com.qiniu.common.QiniuException;import com.qiniu.http.Response;import com.qiniu.storage.UploadManager;import com.qiniu.util.Auth;import com.qiniu.util.StringMap;public class UploadDemo { //设置好账号的ACCESS_KEY和SECRET_KEY String ACCESS_KEY = "Access_Key"; String SECRET_KEY = "Secret_Key"; //要上传的空间 String bucketname = "Bucket_Name"; //上传到七牛后保存的文件名 String key = "my-java.png"; //上传文件的路径 String filePath = "/.../..."; //密钥配置 Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); //创建上传对象 UploadManager uploadManager = new UploadManager(); // 覆盖上传 public String getUpToken(){ //<bucket>:<key>,表示只允许用户上传指定key的文件。在这种格式下文件默认允许“修改”,已存在同名资源则会被本次覆盖。 //如果希望只能上传指定key的文件,并且不允许修改,那么可以将下面的 insertOnly 属性值设为 1。 //第三个参数是token的过期时间 return auth.uploadToken(bucketname, key, 3600); } public void upload() throws IOException{ try { //调用put方法上传,这里指定的key和上传策略中的key要一致 Response res = uploadManager.put(filePath, key, getUpToken()); //打印返回的信息 System.out.println(res.bodyString()); } catch (QiniuException e) { Response r = e.response; // 请求失败时打印的异常的信息 System.out.println(r.toString()); try { //响应的文本信息 System.out.println(r.bodyString()); } catch (QiniuException e1) { //ignore } } } public static void main(String args[]) throws IOException{ new UploadDemo().upload(); }}
断点上传
import java.io.IOException;import com.qiniu.common.QiniuException;import com.qiniu.http.Response;import com.qiniu.storage.Recorder;import com.qiniu.storage.UploadManager;import com.qiniu.storage.persistent.FileRecorder;import com.qiniu.util.Auth;public class UploadDemo { //设置好账号的ACCESS_KEY和SECRET_KEY String ACCESS_KEY = "Access_Key"; String SECRET_KEY = "Secret_Key"; //要上传的空间 String bucketname = "Bucket_Name"; //上传到七牛后保存的文件名 String key = "my-java.png"; //上传文件的路径 String filePath = "/.../..."; //密钥配置 Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); //创建上传对象 UploadManager uploadManager = new UploadManager(); // 覆盖上传 public String getUpToken(){ return auth.uploadToken(bucketname); } public void upload() throws IOException{ //设置断点记录文件保存在指定文件夹或的File对象 String recordPath = "/.../..."; //实例化recorder对象 Recorder recorder = new FileRecorder(recordPath); //实例化上传对象,并且传入一个recorder对象 UploadManager uploadManager = new UploadManager(recorder); try { //调用put方法上传 Response res = uploadManager.put("path/file", "key", getUpToken()); //打印返回的信息 System.out.println(res.bodyString()); } catch (QiniuException e) { Response r = e.response; // 请求失败时打印的异常的信息 System.out.println(r.toString()); try { //响应的文本信息 System.out.println(r.bodyString()); } catch (QiniuException e1) { //ignore } } } public static void main(String args[]) throws IOException{ new UploadDemo().upload(); }}
Base64上传
package demo;import java.io.File;import java.io.FileInputStream;import org.apache.http.HttpResponse;import org.apache.http.client.HttpClient;import org.apache.http.client.methods.HttpPost;import org.apache.http.entity.StringEntity;import org.apache.http.impl.client.HttpClientBuilder;import org.apache.http.util.EntityUtils;import com.qiniu.util.Auth;import com.qiniu.util.Base64;public class Base64PictureDemo { public static void main(String[] args) throws Exception { putb64(); } public static void putb64() throws Exception { String ACCESS_KEY = "ACCESS_KEY"; String SECRET_KEY = "SECRET_KEY"; Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); String token = auth.uploadToken("bucket", "key", 3600, null); FileInputStream fis = null; String file="path/file"; try{ //文件大小 int l = (int)(new File(file).length()); String url = "http://up.qiniu.com/putb64/" + l; byte[] src = new byte[l]; //文件-输入流-字节数组-base64字符串 fis = new FileInputStream(new File(file)); fis.read(src); String file64 = Base64.encodeToString(src, Base64.DEFAULT); //构造post对象 HttpPost post = new HttpPost(url); post.addHeader("Content-Type", "application/octet-stream"); post.addHeader("Authorization", "UpToken " + token); post.setEntity(new StringEntity(file64)); //请求与响应 HttpClient c = HttpClientBuilder.create().build(); HttpResponse res = c.execute(post); //输出 System.out.println(res.getStatusLine()); String responseBody = EntityUtils.toString(res.getEntity(), "UTF-8"); System.out.println(responseBody); }catch(Exception e){ e.printStackTrace(); throw e; }finally{ if(fis != null){ fis.close(); } } }}
上传&回调
import com.qiniu.util.Auth;import com.qiniu.util.StringMap;import java.io.IOException;import com.qiniu.common.QiniuException;import com.qiniu.http.Response;import com.qiniu.storage.UploadManager;public class UploadDemo { //设置好账号的ACCESS_KEY和SECRET_KEY String ACCESS_KEY = "Access_Key"; String SECRET_KEY = "Secret_Key"; //要上传的空间 String bucketname = "Bucket_Name"; //上传到七牛后保存的文件名 String key = "my-java.png"; //上传文件的路径 String FilePath = "/.../..."; //密钥配置 Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); //创建上传对象 UploadManager uploadManager = new UploadManager(); //设置callbackUrl以及callbackBody,七牛将文件名和文件大小回调给业务服务器 public String getUpToken(){ return auth.uploadToken(bucketname,null,3600,new StringMap() .put("callbackUrl","http://your.domain.com/callback") .put("callbackBody", "filename=$(fname)&filesize=$(fsize)")); } public void upload() throws IOException{ try { //调用put方法上传 Response res = uploadManager.put(FilePath, null, getUpToken()); //打印返回的信息 System.out.println(res.bodyString()); } catch (QiniuException e) { Response r = e.response; // 请求失败时打印的异常的信息 System.out.println(r.toString()); try { //响应的文本信息 System.out.println(r.bodyString()); } catch (QiniuException e1) { //ignore } } } public static void main(String args[]) throws IOException{ new UploadDemo().upload(); }}
上传&预转持续化(以视频转码为例)
import com.qiniu.util.Auth;import com.qiniu.util.StringMap;import com.qiniu.util.UrlSafeBase64;import java.io.IOException;import com.qiniu.common.QiniuException;import com.qiniu.http.Response;import com.qiniu.storage.UploadManager;public class UploadDemo { //设置好账号的ACCESS_KEY和SECRET_KEY String ACCESS_KEY = "Access_Key"; String SECRET_KEY = "Secret_Key"; //要上传的空间 String bucketname = "Bucket_Name"; //上传到七牛后保存的文件名 String key = "my-java.png"; //上传文件的路径 String FilePath = "/.../..."; //设置转码操作参数 String fops = "avthumb/mp4/s/640x360/vb/1.25m"; //设置转码的队列 String pipeline = "yourpipelinename"; //可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当前空间。 String urlbase64 = UrlSafeBase64.encodeToString("目标Bucket_Name:自定义文件key"); String pfops = fops +"|saveas/"+ urlbase64; //密钥配置 Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); //创建上传对象 UploadManager uploadManager = new UploadManager(); //上传策略中设置persistentOps字段和persistentPipeline字段 public String getUpToken(){ return auth.uploadToken(bucketname,null,3600,new StringMap() .putNotEmpty("persistentOps", pfops) .putNotEmpty("persistentPipeline", pipeline), true); } public void upload() throws IOException{ try { //调用put方法上传 Response res = uploadManager.put(FilePath, null, getUpToken()); //打印返回的信息 System.out.println(res.bodyString()); } catch (QiniuException e) { Response r = e.response; // 请求失败时打印的异常的信息 System.out.println(r.toString()); try { //响应的文本信息 System.out.println(r.bodyString()); } catch (QiniuException e1) { //ignore } } } public static void main(String args[]) throws IOException{ new UploadDemo().upload(); }}注:上面的Demo只是针对视频转码,如果需要别的功能比如音视频切片、视频截图、视频拼接只需要修改下上面的fops后面的参数就可以了,eg: fops = "vframe/jpg/offset/1/w/480/h/360/rotate/90"就表示视频截图了。下面给出一些常见的数据处理功能,可以根据需要进行选择://------------------图片缩放-------------------fops ="imageView/2/w/200/h/200";//------------------视频转码-------------------// fops ="avthumb/flv/vb/229k/vcodec/libx264/noDomain/1";//------------------图片水印-------------------String pictureurl = UrlSafeBase64.encodeToString("http://developer.qiniu.com/resource/logo-2.jpg");fops = "watermark/1/image/" + pictureurl;//------------------视频切片-------------------fops = "avthumb/m3u8";//切片与加密参数fops = "avthumb/m3u8/vb/640k/hlsKey/MDEyMzQ1Njc4OTEyMzQ1Ng==/hlsKeyUrl/aHR0cDovLzd4bGVrYi5jb20yLnowLmdsYi5xaW5pdWNkbi5jb20vcWluaXV0ZXN0LmtleQ==";//------------------文档转换-------------------fops = "yifangyun_preview";//------------------视频截图-------------------fops = "vframe/jpg/offset/1/w/480/h/360/rotate/90";//------------------视频拼接-------------------//拼接视频片段时要保证所有源的画面长宽值一致//除去作为数据处理对象的源文件以外,还可以指定最多5个源文件(即总计6个片段)//所有源文件必须属于同一存储空间//格式:avconcat/<Mode>/format/<Format>/<encodedUrl0>/<encodedUrl1>/<encodedUrl2>/...String encodedUrl1 = UrlSafeBase64.encodeToString("http://7xl4c9.com1.z0.glb.clouddn.com/pingjie2.flv");String encodedUrl2 = UrlSafeBase64.encodeToString("http://7xl4c9.com1.z0.glb.clouddn.com/pingjie3.avi");fops = "avconcat/2/format/mp4/"+encodedUrl1+encodedUrl2;//------------------多文件压缩-------------------//可将若干七牛空间中的资源文件,在七牛服务端压缩后存储//格式:mkzip/<mode>/url/<Base64EncodedURL>/alias/<Base64EncodedAlias>/url/<Base64EncodedURL>String encodedfile1 = UrlSafeBase64.encodeToString("http://7xl4c9.com1.z0.glb.clouddn.com/photo1.jpg");String encodedfile2 = UrlSafeBase64.encodeToString("http://7xl4c9.com1.z0.glb.clouddn.com/vedio1.mp4");String encodedfile3 = UrlSafeBase64.encodeToString("http://7xl4c9.com1.z0.glb.clouddn.com/audio1.mp3");fops = "mkzip/2/url/"+encodedfile1+"url/"+encodedfile2+"url/"+encodedfile3;
文件下载
生成下载链接
import com.qiniu.util.Auth;public class DownloadDemo { //设置好账号的ACCESS_KEY和SECRET_KEY String ACCESS_KEY = "Access_Key"; String SECRET_KEY = "Secret_Key"; //密钥配置 Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); //构造私有空间的需要生成的下载的链接 String URL = "http://bucketdomain/key"; public void download(){ //调用privateDownloadUrl方法生成下载链接,第二个参数可以设置Token的过期时间 String downloadRUL = auth.privateDownloadUrl(URL,3600); System.out.println(downloadRUL); } public static void main(String args[]){ new DownloadDemo().download(); }}
空间资源的管理
获取文件的信息
import com.qiniu.common.QiniuException;import com.qiniu.http.Response;import com.qiniu.storage.BucketManager;import com.qiniu.storage.model.FileInfo;import com.qiniu.util.Auth;public class BucketManagerDemo { public static void main(String args[]){ //设置需要操作的账号的AK和SK String ACCESS_KEY = "Access_Key"; String SECRET_KEY = "Secret_Key"; Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); //实例化一个BucketManager对象 BucketManager bucketManager = new BucketManager(auth); //要测试的空间和key,并且这个key在你空间中存在 String bucket = "Bucket_Name"; String key = "Bucket_key"; try { //调用stat()方法获取文件的信息 FileInfo info = bucketManager.stat(bucket, key); System.out.println(info.hash); System.out.println(info.key); } catch (QiniuException e) { //捕获异常信息 Response r = e.response; System.out.println(r.toString()); } }}
移动单个文件
import com.qiniu.common.QiniuException;import com.qiniu.http.Response;import com.qiniu.storage.BucketManager;import com.qiniu.storage.model.FileInfo;import com.qiniu.util.Auth;public class BucketManagerDemo { public static void main(String args[]){ //设置需要操作的账号的AK和SK String ACCESS_KEY = "Access_Key"; String SECRET_KEY = "Secret_Key"; Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); //实例化一个BucketManager对象 BucketManager bucketManager = new BucketManager(auth); //要测试的空间和key,并且这个key在你空间中存在 String bucket = "Bucket_Name"; String key = "Bucket_key"; //将文件从文件key移动到文件key2, 可以在不同bucket移动,同空间移动相当于重命名 String key2 = "yourjavakey"; try { //调用move方法移动文件 bucketManager.move(bucket, key, bucket, key2); } catch (QiniuException e) { //捕获异常信息 Response r = e.response; System.out.println(r.toString()); } }}
复制单个文件
import com.qiniu.common.QiniuException;import com.qiniu.http.Response;import com.qiniu.storage.BucketManager;import com.qiniu.storage.model.FileInfo;import com.qiniu.util.Auth;public class BucketManagerDemo { public static void main(String args[]){ //设置需要操作的账号的AK和SK String ACCESS_KEY = "Access_Key"; String SECRET_KEY = "Secret_Key"; Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); //实例化一个BucketManager对象 BucketManager bucketManager = new BucketManager(auth); //要测试的空间和key,并且这个key在你空间中存在 String bucket = "Bucket_Name"; String key = "Bucket_key"; //将文件从文件key 复制到文件key2。 可以在不同bucket复制 String key2 = "yourjavakey"; try { //调用copy方法移动文件 bucketManager.copy(bucket, key, bucket, key2); } catch (QiniuException e) { //捕获异常信息 Response r = e.response; System.out.println(r.toString()); } }}
删除单个文件
import com.qiniu.common.QiniuException;import com.qiniu.http.Response;import com.qiniu.storage.BucketManager;import com.qiniu.storage.model.FileInfo;import com.qiniu.util.Auth;public class BucketManagerDemo { public static void main(String args[]){ //设置需要操作的账号的AK和SK String ACCESS_KEY = "Access_Key"; String SECRET_KEY = "Secret_Key"; Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); //实例化一个BucketManager对象 BucketManager bucketManager = new BucketManager(auth); //要测试的空间和key,并且这个key在你空间中存在 String bucket = "Bucket_Name"; String key = "Bucket_key"; try { //调用delete方法移动文件 bucketManager.delete(bucket, key); } catch (QiniuException e) { //捕获异常信息 Response r = e.response; System.out.println(r.toString()); } }}
Fetch抓取文件
import com.qiniu.common.QiniuException;import com.qiniu.http.Response;import com.qiniu.storage.BucketManager;import com.qiniu.util.Auth;public class FetchDemo { public static void main(String args[]){ //设置需要操作的账号的AK和SK String ACCESS_KEY = "Access_Key"; String SECRET_KEY = "Secret_Key"; Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); //实例化一个BucketManager对象 BucketManager bucketManager = new BucketManager(auth); //文件保存的空间名和文件名 String bucket = "yourbucket"; String key = "yourkey"; //要fetch的url String url = "url"; try { //调用fetch方法抓取文件 bucketManager.fetch(url, bucket,key); } catch (QiniuException e) { //捕获异常信息 Response r = e.response; System.out.println(r.toString()); } }}
Batch批量操作
import com.qiniu.common.QiniuException;import com.qiniu.http.Response;import com.qiniu.storage.BucketManager;import com.qiniu.storage.model.FileInfo;import com.qiniu.storage.model.FileListing;import com.qiniu.util.Auth;public class BatchDemo { public static void main(String args[]){ //设置需要操作的账号的AK和SK String ACCESS_KEY = "Access_Key"; String SECRET_KEY = "Secret_Key"; Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); //实例化一个BucketManager对象 BucketManager bucketManager = new BucketManager(auth); //创建Batch类型的operations对象 BucketManager.Batch operations = new BucketManager.Batch(); //第一组源空间名、原文件名,目的空间名、目的文件名 String bucketFrom1 = "yourbucket"; String keyFrom1 = "srckey1"; String bucketTo1 = "yourbucket"; String keyTo1 = "destkey1"; //第二组源空间名、原文件名,目的空间名、目的文件名 String bucketFrom2 = "yourbucket"; String keyFrom2 = "srckey2"; String bucketTo2 = "yourbucket"; String keyTo2 = "destkey2"; try { //调用批量操作的batch方法 Response res = bucketManager.batch(operations.move(bucketFrom1, keyFrom1, bucketTo1, keyTo1) .move(bucketFrom2, keyFrom2, bucketTo2, keyTo2)); System.out.println(res.toString()); } catch (QiniuException e) { //捕获异常信息 Response r = e.response; System.out.println(r.toString()); } }}
list列举
import com.qiniu.common.QiniuException;import com.qiniu.http.Response;import com.qiniu.storage.BucketManager;import com.qiniu.storage.model.FileInfo;import com.qiniu.storage.model.FileListing;import com.qiniu.util.Auth;public class ListDemo { public static void main(String args[]){ //设置需要操作的账号的AK和SK String ACCESS_KEY = "Access_Key"; String SECRET_KEY = "Secret_Key"; Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); //实例化一个BucketManager对象 BucketManager bucketManager = new BucketManager(auth); //要列举文件的空间名 String bucket = "yourbucket"; try { //调用listFiles方法列举指定空间的指定文件 //参数一:bucket 空间名 //参数二:prefix 文件名前缀 //参数三:marker 上一次获取文件列表时返回的 marker //参数四:limit 每次迭代的长度限制,最大1000,推荐值 100 //参数五:delimiter 指定目录分隔符,列出所有公共前缀(模拟列出目录效果)。缺省值为空字符串 FileListing fileListing = bucketManager.listFiles(bucket,null,null,10,null); FileInfo[] items = fileListing.items; for(FileInfo fileInfo:items){ System.out.println(fileInfo.key); } } catch (QiniuException e) { //捕获异常信息 Response r = e.response; System.out.println(r.toString()); } }}
触发持久化操作(以视频转码为例)
视频转码
import com.qiniu.common.QiniuException;import com.qiniu.http.Response;import com.qiniu.processing.OperationManager;import com.qiniu.util.Auth;import com.qiniu.util.StringMap;import com.qiniu.util.UrlSafeBase64;public class OperateDemo { public static void main(String[] args) throws QiniuException { //设置账号的AK,SK String ACCESS_KEY = "Access_Key"; String SECRET_KEY = "Secret_Key"; Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); //新建一个OperationManager对象 OperationManager operater = new OperationManager(auth); //设置要转码的空间和key,并且这个key在你空间中存在 String bucket = "Bucket_Name"; String key = "Bucket_key"; //设置转码操作参数 String fops = "avthumb/mp4/s/640x360/vb/1.25m"; //设置转码的队列 String pipeline = "yourpipelinename"; //可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当前空间。 String urlbase64 = UrlSafeBase64.encodeToString("目标Bucket_Name:自定义文件key"); String pfops = fops + "|saveas/"+urlbase64; //设置pipeline参数 StringMap params = new StringMap().putWhen("force", 1, true).putNotEmpty("pipeline", pipeline); try { String persistid = operater.pfop(bucket, key, pfops, params); //打印返回的persistid System.out.println(persistid); } catch (QiniuException e) { //捕获异常信息 Response r = e.response; // 请求失败时简单状态信息 System.out.println(r.toString()); try { // 响应的文本信息 System.out.println(r.bodyString()); } catch (QiniuException e1) { //ignore } } }}注:上面的Demo只是针对视频转码,如果需要别的功能比如音视频切片、视频截图、视频拼接只需要修改下上面的fops后面的参数就可以了,eg: fops = "vframe/jpg/offset/1/w/480/h/360/rotate/90"就表示视频截图了。下面给出一些常见的数据处理功能,可以根据需要进行选择://------------------图片缩放-------------------fops ="imageView/2/w/200/h/200";//------------------视频转码-------------------// fops ="avthumb/flv/vb/229k/vcodec/libx264/noDomain/1";//------------------图片水印-------------------String pictureurl = UrlSafeBase64.encodeToString("http://developer.qiniu.com/resource/logo-2.jpg");fops = "watermark/1/image/" + pictureurl;//------------------视频切片-------------------fops = "avthumb/m3u8";//切片与加密参数fops = "avthumb/m3u8/vb/640k/hlsKey/MDEyMzQ1Njc4OTEyMzQ1Ng==/hlsKeyUrl/aHR0cDovLzd4bGVrYi5jb20yLnowLmdsYi5xaW5pdWNkbi5jb20vcWluaXV0ZXN0LmtleQ==";//------------------文档转换-------------------fops = "yifangyun_preview";//------------------视频截图-------------------fops = "vframe/jpg/offset/1/w/480/h/360/rotate/90";//------------------视频拼接-------------------//拼接视频片段时要保证所有源的画面长宽值一致//除去作为数据处理对象的源文件以外,还可以指定最多5个源文件(即总计6个片段)//所有源文件必须属于同一存储空间//格式:avconcat/<Mode>/format/<Format>/<encodedUrl0>/<encodedUrl1>/<encodedUrl2>/...String encodedUrl1 = UrlSafeBase64.encodeToString("http://7xl4c9.com1.z0.glb.clouddn.com/pingjie2.flv");String encodedUrl2 = UrlSafeBase64.encodeToString("http://7xl4c9.com1.z0.glb.clouddn.com/pingjie3.avi");fops = "avconcat/2/format/mp4/"+encodedUrl1+encodedUrl2;//------------------多文件压缩-------------------//可将若干七牛空间中的资源文件,在七牛服务端压缩后存储//格式:mkzip/<mode>/url/<Base64EncodedURL>/alias/<Base64EncodedAlias>/url/<Base64EncodedURL>String encodedfile1 = UrlSafeBase64.encodeToString("http://7xl4c9.com1.z0.glb.clouddn.com/photo1.jpg");String encodedfile2 = UrlSafeBase64.encodeToString("http://7xl4c9.com1.z0.glb.clouddn.com/vedio1.mp4");String encodedfile3 = UrlSafeBase64.encodeToString("http://7xl4c9.com1.z0.glb.clouddn.com/audio1.mp3");fops = "mkzip/2/url/"+encodedfile1+"url/"+encodedfile2+"url/"+encodedfile3;
2 2
- 七牛---关于JAVA SDK的各种Demo
- 七牛---关于C# SDK的各种Demo
- 七牛---关于PHP SDK的各种Demo
- 七牛---关于Python SDK的各种Demo
- 七牛---关于Ruby SDK的各种Demo
- 七牛---关于Node.js SDK的各种Demo
- 七牛---关于GO SDK的各种Demo
- 七牛---关于PHP SDK的各种Demo
- 【转自戴Sir】七牛关于Python SDK的各种Demo
- 七牛---各种SDK Demo汇总
- 七牛---关于JavaScript SDK各种问题总结
- 七牛---关于JavaScript SDK各种问题总结
- 七牛---Android SDK断点续传与暂停上传Demo
- 七牛---Android SDK断点续传与暂停上传Demo
- 七牛java自己写的pfop操作,非官方sdk。
- 七牛java-sdk生成token。
- 七牛---Java SDK常见问题总结
- 七牛---关于Android SDK jar包依赖情况总结
- 深刻理解Linux进程间通信(IPC)
- 建立目录树
- 创建各种工具栏真彩色位图
- 个人热点蓝条出现和消失时,页面下压和恢复导致页面混乱及蓝条下压页面底部控件看不到的问题
- project net netbeans服务器设置
- 七牛---关于JAVA SDK的各种Demo
- Angular的侦察兵:$watch()和$observe()
- Web UI 优化自动化测试用例的稳定性
- html5 jqueryrotate插件实现旋转动画
- 配置远程服务器和本地服务器
- 修改placeholder的颜色
- iOS审核被拒 22.4 - Apps that enable illegal file sharing will be rejected
- linux的7种运行级别
- C# DataGridView