Search in sources :

Example 1 with PutObjectArgs

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);
    }
}
Also used : MinioClient(io.minio.MinioClient) InputStream(java.io.InputStream) PutObjectArgs(io.minio.PutObjectArgs) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig) StorageException(org.codelibs.fess.exception.StorageException) StorageException(org.codelibs.fess.exception.StorageException) ErrorResponseException(io.minio.errors.ErrorResponseException)

Aggregations

MinioClient (io.minio.MinioClient)1 PutObjectArgs (io.minio.PutObjectArgs)1 ErrorResponseException (io.minio.errors.ErrorResponseException)1 InputStream (java.io.InputStream)1 StorageException (org.codelibs.fess.exception.StorageException)1 FessConfig (org.codelibs.fess.mylasta.direction.FessConfig)1