use of io.minio.PutObjectArgs in project fess by codelibs.
the class AdminStorageAction method uploadObject.
public static void uploadObject(final String objectName, final MultipartFormFile uploadFile) {
try (final InputStream in = uploadFile.getInputStream()) {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final MinioClient minioClient = createClient(fessConfig);
final PutObjectArgs args = PutObjectArgs.builder().bucket(fessConfig.getStorageBucket()).object(objectName).stream(in, uploadFile.getFileSize(), -1).contentType("application/octet-stream").build();
minioClient.putObject(args);
} catch (final Exception e) {
throw new StorageException("Failed to upload " + objectName, e);
}
}
Aggregations