Skip to content

Commit 66fd667

Browse files
committed
add bodyStream method for Client in case when SDK used to download big files.
1 parent 417439a commit 66fd667

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main/java/com/qiniu/http/Response.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import okhttp3.MediaType;
99

1010
import java.io.IOException;
11+
import java.io.InputStream;
1112
import java.util.Locale;
1213

1314
/**
@@ -198,6 +199,13 @@ public String bodyString() throws QiniuException {
198199
return StringUtils.utf8String(body());
199200
}
200201

202+
public synchronized InputStream bodyStream() throws QiniuException {
203+
if (this.response == null) {
204+
return null;
205+
}
206+
return this.response.body().byteStream();
207+
}
208+
201209
public String contentType() {
202210
return ctype(response);
203211
}

0 commit comments

Comments
 (0)