I have a String converted with org.apache.axis2.databinding.utils.ConverterUtil to a Base64Binary (ByteArrayDataSource inside a DataHandler).
When I try to convert it back to the string, it doestn work. I cant figure out why. What am I missing?
Here`s the code:
@Test
public void testBase64() {
DataHandler test = ConverterUtil.convertToBase64Binary("TEST");
try {
BufferedReader br = new BufferedReader(new InputStreamReader(test.getDataSource().getInputStream()));
StringBuilder sb = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
sb.append(line);
}
br.close();
String result = new String(Base64.decode(sb.toString()));
} catch (IOException e) {
e.printStackTrace();
}
As you can see.. result string is empty.. I hope someone can help me with this.
Thanks