Skip to content

Commit 1d687d2

Browse files
committed
format
1 parent 2857c4a commit 1d687d2

File tree

2 files changed

+36
-35
lines changed

2 files changed

+36
-35
lines changed

src/main/java/com/qiniu/api/rs/PutPolicy.java

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -47,26 +47,27 @@ public class PutPolicy {
4747

4848
public long deadline;
4949

50-
/**
51-
*
52-
* 对文件先进行一次变换操作(比如将音频统一转为某种码率的mp3)再进行存储。
53-
* transform的值就是一个fop指令,比如 "avthumb/mp3"。其含义是对上传的文件
54-
* 执行这个 fop 指令,然后把结果保存到七牛。最后保存的是经过处理过的文件,
55-
* 而不是用户上传的原始文件。
56-
**/
57-
public String transform;
50+
/**
51+
*
52+
* 对文件先进行一次变换操作(比如将音频统一转为某种码率的mp3)再进行存储。
53+
* transform的值就是一个fop指令,比如 "avthumb/mp3"。其含义是对上传的文件
54+
* 执行这个 fop 指令,然后把结果保存到七牛。最后保存的是经过处理过的文件,
55+
* 而不是用户上传的原始文件。
56+
*
57+
**/
58+
public String transform;
5859

59-
/**
60-
*
61-
* 单位: 秒
62-
* 文件变换操作执行的超时时间(单位:秒),上传和转码操作是同步进行的,
63-
* 先上传后转码,这个时间只是转码所需时间,不包括上传文件所需时间。
64-
* 这个值太小可能会导致误判(最终存储成功了但客户端得到超时的错误),
65-
* 但太大可能会导致服务端将其判断为低优先级任务。建议取一个相对准确的
66-
* 时间估计值*N(N不要超过5)。
67-
*
68-
**/
69-
public long fopTimeout;
60+
/**
61+
*
62+
* 单位: 秒
63+
* 文件变换操作执行的超时时间(单位:秒),上传和转码操作是同步进行的,
64+
* 先上传后转码,这个时间只是转码所需时间,不包括上传文件所需时间。
65+
* 这个值太小可能会导致误判(最终存储成功了但客户端得到超时的错误),
66+
* 但太大可能会导致服务端将其判断为低优先级任务。建议取一个相对准确的
67+
* 时间估计值*N(N不要超过5)。
68+
*
69+
**/
70+
public long fopTimeout;
7071

7172
public PutPolicy(String scope) {
7273
this.scope = scope;
@@ -112,12 +113,12 @@ public String marshal() throws JSONException {
112113
if (this.persistentOps != null && this.persistentOps.length() > 0) {
113114
stringer.key("persistentOps").value(this.persistentOps);
114115
}
115-
if (this.transform != null && this.transform.length() > 0) {
116-
stringer.key("transform").value(this.transform);
117-
}
118-
if (this.fopTimeout > 0) {
119-
stringer.key("fopTimeout").value(this.fopTimeout);
120-
}
116+
if (this.transform != null && this.transform.length() > 0) {
117+
stringer.key("transform").value(this.transform);
118+
}
119+
if (this.fopTimeout > 0) {
120+
stringer.key("fopTimeout").value(this.fopTimeout);
121+
}
121122
stringer.key("deadline").value(this.deadline);
122123
stringer.endObject();
123124

src/test/java/com/qiniu/testing/IOTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@ public void testPut() throws Exception {
6464
}
6565
}
6666

67-
/**
68-
* 这个案例测试上传后转码并将转码结果保存为目标文件。例中使用了 PutPolicy 中的
69-
* transform 和 fopTimeout 两个参数,分别对应要进行的转码操作和转码超时时间,
70-
* 测试的时候请将例中的 localFile 改成合法的文件路径。
71-
**/
67+
/**
68+
* 这个案例测试上传后转码并将转码结果保存为目标文件。例中使用了 PutPolicy 中的
69+
* transform 和 fopTimeout 两个参数,分别对应要进行的转码操作和转码超时时间,
70+
* 测试的时候请将例中的 localFile 改成合法的文件路径。
71+
**/
7272
public void testPutTransform() throws Exception {
73-
PutPolicy putPolicy = new PutPolicy(bucketName);
74-
putPolicy.transform = "avthumb/mp3";
75-
putPolicy.fopTimeout = 60;
73+
PutPolicy putPolicy = new PutPolicy(bucketName);
74+
putPolicy.transform = "avthumb/mp3";
75+
putPolicy.fopTimeout = 60;
7676

77-
String uptoken = putPolicy.token(mac);
77+
String uptoken = putPolicy.token(mac);
7878
String localFile = "/Users/ikbear/7niu/music.mp4";
79-
String key = "music-ikbear.mp3";
79+
String key = "music-ikbear.mp3";
8080

8181
PutExtra extra = new PutExtra();
8282

0 commit comments

Comments
 (0)