Skip to content

Commit 9db1f46

Browse files
author
Joshua Yin
committed
* 上传API文档
* 更新README
1 parent 027b753 commit 9db1f46

3 files changed

Lines changed: 69 additions & 3 deletions

File tree

README.md

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@
88
- ~~[Ver 1.0.0](https://github.com/ufilesdk-dev/ufile-javasdk)~~ 不建议使用
99

1010
## 环境要求
11-
- Java 1.8或以上
11+
- 开发环境: Java 1.8或以上
12+
- 运行环境: 可向下兼容至 Java 1.7, 详情请查看**`兼容Java 1.7`**
1213

14+
## API Doc
15+
16+
- **[ufile-client-java ](https://github.com/ucloud/ufile-sdk-java/tree/master/ufile/ufile-client-java/apidocs.zip)**
17+
- **[ufile-core ](https://github.com/ucloud/ufile-sdk-java/tree/master/ufile/ufile-core/apidocs.zip)**
18+
1319
## 安装
1420
- Maven
1521

@@ -19,7 +25,7 @@
1925
<dependency>
2026
<groupId>cn.ucloud.ufile</groupId>
2127
<artifactId>ufile-client-java</artifactId>
22-
<version>2.0.6</version>
28+
<version>2.1.0</version>
2329
</dependency>
2430
```
2531

@@ -30,7 +36,7 @@
3036
/*
3137
* your other dependencies
3238
*/
33-
implementation 'cn.ucloud.ufile:ufile-client-java:2.0.6'
39+
implementation 'cn.ucloud.ufile:ufile-client-java:2.1.0'
3440
}
3541
```
3642

@@ -209,6 +215,66 @@ UfileClient.object(OBJECT_AUTHORIZER, config)
209215
});
210216
```
211217

218+
## 兼容Java 1.7
219+
> 由于默认版本基于Java 1.8开发,SDK内部使用到的Base64都来自于Java 1.8提供的Base64模块。
220+
221+
- 若您的项目实际运行环境为Java 1.7,那么请注意一下几个API的使用:
222+
- UfileSigner:
223+
在您使用BucketLocalAuthorizationObjectLocalAuthorization及其子类的时候,请使用参数为: `(String publicKey, String privateKey, Signer signer)` 的构造方法。其中Signer接口的实例可使用`UfileSigner`,并使用参数为 `(Base64StdEncoderCompat base64)`的构造方法
224+
225+
``` java
226+
public abstract class BucketLocalAuthorization extends BucketAuthorization {
227+
/**
228+
* 构造方法 (若您的运行环境在Java 1.8以下,请使用该方法)
229+
*
230+
* @param publicKey 用户公钥
231+
* @param privateKey 用户私钥
232+
* @param signer 签名器 {@link Signer}
233+
*/
234+
protected BucketLocalAuthorization(String publicKey, String privateKey, Signer signer) {
235+
super(publicKey);
236+
this.privateKey = privateKey;
237+
this.signer = signer;
238+
}
239+
}
240+
```
241+
242+
``` java
243+
public final class UfileSigner implements Signer {
244+
/**
245+
* 构造方法 (若您的运行环境在Java 1.8以下,请使用该方法)
246+
*
247+
* @param base64 兼容Java 1.8以下的Base64 标准编码器接口
248+
*/
249+
public UfileSigner(Base64StdEncoderCompat base64) {
250+
this.base64 = base64;
251+
}
252+
}
253+
```
254+
255+
- Etag:
256+
所有的和Etag值计算相关的方法和类,在使用时请选用带有`Base64UrlEncoderCompat`参数的方法。并且与其相关的以下API:
257+
258+
- DownloadFileApi
259+
- UploadFileHitApi
260+
- UploadStreamHitApi
261+
262+
请配置以下参数:
263+
``` java
264+
/**
265+
* 配置Base64 Url编码器,不调用该方法将会默认使用Java 1.8的Base64类
266+
* (若您的运行环境在Java 1.8以下,请使用该方法)
267+
*
268+
* @param base64 兼容Java 1.8以下的Base64 Url编码器接口
269+
* @return {@link UploadStreamHitApi}
270+
*/
271+
public Object withBase64UrlEncoder(Base64UrlEncoderCompat base64) {
272+
this.base64 = base64;
273+
return this;
274+
}
275+
```
276+
277+
212278
## License
213279
[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html)
214280

379 KB
Binary file not shown.

ufile/ufile-core/apidocs.zip

538 KB
Binary file not shown.

0 commit comments

Comments
 (0)