@@ -197,8 +197,8 @@ public class UploadFile {
197197 String uptoken = putPolicy.token(mac);
198198 PutExtra extra = new PutExtra();
199199 String key = "<key>";
200- File file = new File("<your local file path>") ;
201- PutRet ret = IoApi.put (uptoken, key, file , extra);
200+ String localFile = "< local file path>";
201+ PutRet ret = IoApi.putFile (uptoken, key, localFile , extra);
202202 }
203203}
204204
@@ -217,7 +217,7 @@ public class UploadFile {
217217[ uptoken] ( http://docs.qiniu.com/api/put.html#uploadToken ) 实际上是用 AccessKey/SecretKey 进行数字签名的上传策略(` rs.PutPolicy ` ),它控制则整个上传流程的行为。让我们快速过一遍你都能够决策啥:
218218
219219* ` expires ` 指定 [ uptoken] ( http://docs.qiniu.com/api/put.html#uploadToken ) 有效期(默认1小时)。一个 [ uptoken] ( http://docs.qiniu.com/api/put.html#uploadToken ) 可以被用于多次上传(只要它还没有过期)。
220- * ` scope ` 限定客户端的权限。如果 ` scope ` 是 bucket,则客户端只能新增文件到指定的 bucket,不能修改文件。如果 ` scope ` 为 bucket: key ,则客户端可以修改指定的文件。
220+ * ` scope ` 限定客户端的权限。如果 ` scope ` 是 bucket,则客户端只能新增文件到指定的 bucket,不能修改文件。如果 ` scope ` 为 bucket: key ,则客户端可以修改指定的文件。** 注意: key必须采用utf8编码,如使用非utf8编码访问七牛云存储将反馈错误 **
221221* ` callbackUrl ` 设定业务服务器的回调地址,这样业务服务器才能感知到上传行为的发生。可选。
222222* ` asyncOps ` 可指定上传完成后,需要自动执行哪些数据处理。这是因为有些数据处理操作(比如音视频转码)比较慢,如果不进行预转可能第一次访问的时候效果不理想,预转可以很大程度改善这一点。
223223* ` returnBody ` 可调整返回给客户端的数据包(默认情况下七牛返回文件内容的 ` hash ` ,也就是下载该文件时的 ` etag ` )。这只在没有 ` CallbackUrl ` 时有效。
@@ -242,7 +242,9 @@ public class UploadFile {
242242
243243 [GET] http://<domain>/<key>
244244
245- 其中<domain >可以到[ 七牛云存储开发者自助网站] ( https://portal.qiniu.com ) 绑定, 域名可以使用自己一级域名的或者是由七牛提供的二级域名(` <bucket>.qiniudn.com ` )。注意,尖括号不是必需,代表替换项。
245+ 其中\< domain\> 是bucket所对应的域名。七牛云存储为每一个bucket提供一个默认域名。默认域名可以到[ 七牛云存储开发者平台] ( https://portal.qiniu.com/ ) 中,空间设置的域名设置一节查询。用户也可以将自有的域名绑定到bucket上,通过自有域名访问七牛云存储。
246+
247+ ** 注意: key必须采用utf8编码,如使用非utf8编码访问七牛云存储将反馈错误**
246248
247249<a name =" private-download " ></a >
248250
@@ -674,8 +676,24 @@ public class ListPrefix {
674676 Config.ACCESS_KEY = "<YOUR APP ACCESS_KEY>";
675677 Config.SECRET_KEY = "<YOUR APP SECRET_KEY>";
676678 Mac mac = new Mac(Config.ACCESS_KEY, Config.SECRET_KEY);
679+
677680 RSFClient client = new RSFClient(mac);
678- client.listPrifix("<bucketName>", "<prefix>", "<marker>", 10);
681+ String marker = "";
682+
683+ List<ListItem> all = new ArrayList<ListItem>();
684+ ListPrefixRet ret = null;
685+ while (true) {
686+ ret = client.listPrifix(bucketName, "<prifix>", marker, 10);
687+ marker = ret.marker;
688+ all.addAll(ret.results);
689+ if (!ret.ok()) {
690+ // no more items or error occurs
691+ break;
692+ }
693+ }
694+ if (ret.exception.getClass() != RSFEofException.class) {
695+ // error handler
696+ }
679697 }
680698}
681699```
0 commit comments