This mainly applies for integrations that uses SFTP on inbound endpoints. It
could apply to other integrations as well.
Using MiscUtil.readFileAsString requires two unnecessary conversions that
involves encoding (file -> convert -> String -> convert -> file). If the
content of the file is read into a bytearray instead there is no need for any
conversion that takes encoding into account.
Currently there is a bug in mule sftp connector that has to be worked around
due to the encoding dependent conversion:
http://www.mulesoft.org/jira/browse/MULE-6055
So use:
byte [] input = IOUtils.toByteArray(new FileInputStream(inputFile));
instead of
String input = MiscUtil.readFileAsString(inputFile);
Where IOUtils is from commons-io (org.apache.commons.io.IOUtils)
I think that both methods readFileAsString can be dropped since they are
available in IOUtils.
Original issue reported on code.google.com by par.wena...@gmail.com on 11 Sep 2012 at 1:55
Original issue reported on code.google.com by
par.wena...@gmail.com
on 11 Sep 2012 at 1:55