简体   繁体   中英

convert Image(byte array ) into multipart file (jpg format) Java

Issue: Not able to convert the bytes to multipart file,I used custom multipart file to wrap bytes, name, size, content type. Image is store in specific folder.Source of image we are reading from s3 bucket and converting to the byteArray then I'm trying to convert the bytesteam into image enter image description here

I think the easiest way to do would be to create a simple MultiplartFormDataOutput object and send it to the proxy.

Here is a simple example:

MultipartFormDataOutput output = new   MultipartFormDataOutput();
// It is possible to pass a File object or a InputStream in the addFormData
output.addFormData("file", fileObject, MediaType.APPLICATION_OCTET_STREAM_TYPE, filename);
proxy.add(output)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM