mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
commit
deacae9dd7
@ -78,12 +78,13 @@ public class GridFsManager {
|
||||
public void download(File targetFile, String bucketName, String fileName) throws IOException {
|
||||
if (available()) {
|
||||
GridFSBucket bucket = getBucket(bucketName);
|
||||
byte[] buffer = new byte[1024];
|
||||
try (GridFSDownloadStream gis = bucket.openDownloadStream(fileName);
|
||||
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(targetFile))
|
||||
) {
|
||||
while (gis.read(buffer) != -1) {
|
||||
bos.write(buffer);
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytes = 0;
|
||||
while ((bytes = gis.read(buffer)) != -1) {
|
||||
bos.write(buffer, 0, bytes);
|
||||
}
|
||||
bos.flush();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user