@Test void testDownloadFile() throws XmlPullParserException, NoSuchAlgorithmException, InvalidKeyException, IOException { fileManager.downloadFile(minioClient,bucketName,objectName,testPath+downloadFileName); File file = new File(testPath + downloadFileName); assertTrue(file.exists()); }
public void downloadFile(MinioClient minioClient, String bucketName, String objectName, String downloadPath) throws XmlPullParserException, NoSuchAlgorithmException, InvalidKeyException, IOException { File file = new File(downloadPath); try (OutputStream out = new FileOutputStream(file)) { InputStream inputStream = minioClient.getObject(bucketName, objectName); byte[] tempbytes = new byte[100]; int byteread = 0; while ((byteread = inputStream.read(tempbytes)) != -1) { out.write(tempbytes, 0, byteread); } System.out.println("get " + objectName + " to " + downloadPath + ",OK"); } catch (MinioException e) { System.out.println("Error occurred: " + e); } }
FileManager { public void downloadFile(MinioClient minioClient, String bucketName, String objectName, String downloadPath) throws XmlPullParserException, NoSuchAlgorithmException, InvalidKeyException, IOException { File file = new File(downloadPath); try (OutputStream out = new FileOutputStream(file)) { InputStream inputStream = minioClient.getObject(bucketName, objectName); byte[] tempbytes = new byte[100]; int byteread = 0; while ((byteread = inputStream.read(tempbytes)) != -1) { out.write(tempbytes, 0, byteread); } System.out.println("get " + objectName + " to " + downloadPath + ",OK"); } catch (MinioException e) { System.out.println("Error occurred: " + e); } } }
FileManager { public void downloadFile(MinioClient minioClient, String bucketName, String objectName, String downloadPath) throws XmlPullParserException, NoSuchAlgorithmException, InvalidKeyException, IOException { File file = new File(downloadPath); try (OutputStream out = new FileOutputStream(file)) { InputStream inputStream = minioClient.getObject(bucketName, objectName); byte[] tempbytes = new byte[100]; int byteread = 0; while ((byteread = inputStream.read(tempbytes)) != -1) { out.write(tempbytes, 0, byteread); } System.out.println("get " + objectName + " to " + downloadPath + ",OK"); } catch (MinioException e) { System.out.println("Error occurred: " + e); } }  }
FileManager { public void downloadFile(MinioClient minioClient, String bucketName, String objectName, String downloadPath) throws XmlPullParserException, NoSuchAlgorithmException, InvalidKeyException, IOException { File file = new File(downloadPath); try (OutputStream out = new FileOutputStream(file)) { InputStream inputStream = minioClient.getObject(bucketName, objectName); byte[] tempbytes = new byte[100]; int byteread = 0; while ((byteread = inputStream.read(tempbytes)) != -1) { out.write(tempbytes, 0, byteread); } System.out.println("get " + objectName + " to " + downloadPath + ",OK"); } catch (MinioException e) { System.out.println("Error occurred: " + e); } }  void uploadFile(MinioClient minioClient, String bucketName, String objectName, String filePath); void downloadFile(MinioClient minioClient, String bucketName, String objectName, String downloadPath); void deleteFile(MinioClient minioClient, String bucketName, String objectName); void listFile(MinioClient minioClient, String bucketName); void getObjectStat(MinioClient minioClient, String bucketName, String objectName); boolean checkFileExist(MinioClient minioClient, String bucketName, String objectName); }
FileManager { public void downloadFile(MinioClient minioClient, String bucketName, String objectName, String downloadPath) throws XmlPullParserException, NoSuchAlgorithmException, InvalidKeyException, IOException { File file = new File(downloadPath); try (OutputStream out = new FileOutputStream(file)) { InputStream inputStream = minioClient.getObject(bucketName, objectName); byte[] tempbytes = new byte[100]; int byteread = 0; while ((byteread = inputStream.read(tempbytes)) != -1) { out.write(tempbytes, 0, byteread); } System.out.println("get " + objectName + " to " + downloadPath + ",OK"); } catch (MinioException e) { System.out.println("Error occurred: " + e); } }  void uploadFile(MinioClient minioClient, String bucketName, String objectName, String filePath); void downloadFile(MinioClient minioClient, String bucketName, String objectName, String downloadPath); void deleteFile(MinioClient minioClient, String bucketName, String objectName); void listFile(MinioClient minioClient, String bucketName); void getObjectStat(MinioClient minioClient, String bucketName, String objectName); boolean checkFileExist(MinioClient minioClient, String bucketName, String objectName);  }