我已经开发了以下代码来将 base64 字符串数据转换为字节数组,但它正在显示IOException
public static EncodedImage getProfileByteArray(String profilePic){
byte[] data=profilePic.getBytes();
byte[] base64Data;
Bitmap bitmap=null;
EncodedImage fullImage=null;
try {
base64Data = Base64InputStream.decode(data, 0, data.length);
fullImage = EncodedImage.createEncodedImage(base64Data, 0, base64Data.length);
bitmap = fullImage.getBitmap();
System.out.println(data);
} catch (IOException e) {
e.printStackTrace();
System.out.println(e+"lkllllllllllllllll");
}
catch(Exception e){
System.out.println(e+"lkllllllllllllllll");
}
return fullImage;
}
方法是我正在调用一个 web 服务,通过它我获取 base64 图像字符串并尝试将此 base64 字符串转换为字节数组以显示EncodedImage
格式的图像。