So after looking at a similar SO Post about String and DataHandlers, I have run into a problem in terms of efficiency. I have a String coming into my web service that is already encoded. I have the need to convert this String into a DataHandler
to put into a POJO and send off to another service. When I use new ByteArrayDataSource(String, type)
it is encoding the already encoded String (a 2nd time).
To work around this I am decoding the input, and then passing the created byte[]
into new ByteArrayDataSource(byte[], type)
. I am worried about the performance hit this will create when having to decode and re-encode images, when I already have an encoded version being passed in. Is there a way to create a DataHandler
(or DataSource
) from an already encoded String without needing the "MIME type", so I don't have to decode to encode?
I have tried using FileDataSource(String)
but this was not working, with the same input used in a working ByteArrayDataSource(byte[], String)
with decoded Strings. I also tried it passing in a blank string for the type using ByteArrayDataSource(String, type)
.