I need a code snippt for converting DataHandler
to byte[]
.
This data handler contains Image
.
It can be done by using below code without much effort using apache IO Commons.
final InputStream in = dataHandler.getInputStream();
byte[] byteArray=org.apache.commons.io.IOUtils.toByteArray(in);