I currently have a Spring API service that takes a Base64 String img and decodes it.
String imageDataBytes = img.substring(img.indexOf(",")+1);
InputStream stream = new ByteArrayInputStream(Base64.decodeBase64(imageDataBytes));
I want to load contents of stream onto a Resource class. But so far my research is telling me I can only load resources through a URL or file path, which I don't have here. What can I do?
You can use ByteArrayResource. It takes a byte array in constructor. Here is the documentation .
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.