我试图将base64字符串转换为字节数组,但它抛出以下错误
java.lang.IllegalArgumentException:非法base64字符3a
我试过以下选项userimage是base64字符串
byte[] img1 = org.apache.commons.codec.binary.Base64.decodeBase64(userimage);`
/* byte[] decodedString = Base64.getDecoder().decode(encodedString.getBytes(UTF_8));*/
/* byte[] byteimage =Base64.getDecoder().decode( userimage );*/
/* byte[] byteimage = Base64.getMimeDecoder().decode(userimage);*/`
Run Code Online (Sandbox Code Playgroud) 我收到以下 json 格式的响应
enter code here
var blob = new Blob($(this).attr('filedata'), {
type: 'application/pdf'
});
var objectURL = URL.createObjectURL(blob);
// Create an iframe to demonstrate it:
var iframe = document.createElement('iframe');
iframe.className = 'sample-iframe';
iframe.src = objectURL;
document.body.appendChild(iframe);
Run Code Online (Sandbox Code Playgroud)
上面的代码我用来显示字节数组中的pdf