I want to convert a javax.activation.DataHandler object to byte array. What is the best way to do it. Is it possible to use nio package for same.
Asked
Active
Viewed 711 times
1 Answers
0
You can try using something like this:
import org.apache.commons.io.IOUtils;
DataHandler dataHandler = new DataHandler();
InputStream dataHandler = file.getInputStream();
byte[] arrayByte = IOUtils.toByteArray(dataHandler);

Matías Galli
- 91
- 7