Minio API没有显示不完整的上传

时间:2019-01-28 15:08:39

标签: java minio

我是Minio的新手,并试图演示不完整的上传功能。我试图上传一个非常大的文件,并杀死了两者之间的客户端。当我检查ListincompleteUploads的响应时,在迭代器中根本找不到任何条目。难道我做错了什么?有人可以帮忙吗?预先感谢。

public void uploadFile() throws InvalidEndpointException, InvalidPortException, InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, XmlPullParserException, RegionConflictException, InvalidArgumentException {
     MinioClient minioClient = new MinioClient("http://127.0.0.1:9000","AccessKey","Secretkey");
     boolean isExist = minioClient.bucketExists("highres");
      if(isExist) {
        System.out.println("Bucket already exists.");
      } else {
        // Make a new bucket called asiatrip to hold a zip file of photos.
        minioClient.makeBucket("highres");
      }
      Iterable<Result<Upload>> uploads = minioClient.listIncompleteUploads("highres");
     List<Bucket> bucketList = minioClient.listBuckets();
     bucketList.forEach((b)->{System.out.println(b.toString());
    b.forEach((b1,b2)->{System.out.println(b1+":::"+b2);});

     });
      System.out.println("uploading hres stuff");
      minioClient.putObject("highres","hres1", "D://Hres.jpg");
     InputStream tmp = minioClient.getObject("highres", "hres1");
     File f=new File("D://hres_out.jpg");

     OutputStream outStream = new FileOutputStream(f);
     byte[] buffer = new byte[8 * 1024];
     int bytesRead;
     while ((bytesRead = tmp.read(buffer)) != -1) {
         outStream.write(buffer, 0, bytesRead);
     }
     IOUtils.closeQuietly(tmp);
     IOUtils.closeQuietly(outStream);

}

0 个答案:

没有答案