Possible Duplicate:
Decode Base64 data in Java
enter code here
I have an image in base64 String: data:image/png;base64,iVBORw0KGgoAAAANS....
i would like to convert this String back to an image and store it to the server. Does anyone have any examples of this done in java.
I am having an error : The type org.apache.tomcat.util.buf.CharChunk cannot be resolved. It is indirectly referenced from required .class files (on the second line);
This is my code i am not sure what i am doing incorrectly:
String encodedString = citizens.getPhoto();
byte[] ba = Base64.decode(encodedString);
decodedString = new String(ba);
try {
byte[] imageByteArray = decoder.decodeBuffer(citizens.getPhoto());
FileOutputStream imageOutFile = new FileOutputStream(
"/resources/photos/mypic.jpg");
imageOutFile.write(imageByteArray);
imageOutFile.close();
logger.info("Image Successfully Manipulated!");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}