foo :
There is a way to convert inputStream to a String, and encode it to base64, right? In my function, I get InputStream param, and need to insert it into the BLOB field in my Oracle database table. Is there a way to do that? (my database object contains string field to save the image, but I don't find any way to convert the inputStream to string in base64 format) Thank you!
mhasan :
You can try something like this using the Base64 API.
InputStream finput = new FileInputStream(file);
byte[] imageBytes = new byte[(int)file.length()];
finput.read(imageBytes, 0, imageBytes.length);
finput.close();
String imageStr = Base64.encodeBase64String(imageBytes);
Use this:
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=450293&siteId=1