FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java-sdk/examples/stat.java at master · CDNCloud-com/java-sdk · GitHub
CDNCloud-com
/
java-sdk
Public
forked from
qiniu/java-sdk
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java-sdk
/
examples
/
stat.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (31 loc) · 1.21 KB
Breadcrumbs
java-sdk
/
examples
/
stat.java
Copy path
File metadata and controls
36 lines (31 loc) · 1.21 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
;
import
com
.
qiniu
.
common
.
Zone
;
import
com
.
qiniu
.
storage
.
Configuration
;
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
);
Zone
z
=
Zone
.
zone0
();
Configuration
c
=
new
Configuration
(
z
);
//实例化一个BucketManager对象
BucketManager
bucketManager
=
new
BucketManager
(
auth
,
c
);
//要测试的空间和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
());
}
}
Back
|
FazBrowse Home
|
New Git URL