on 03-03-2011 2:02 PM
Hi,
While sending the file to the target directory ,need to convert the content to base64 code format.How we can achieve this.
Regards,
Hymavathi
Hi,
You can take the entire input that you need to convert to base64 to this UDF which takes a single string array as input say var1[ ] and it has a single ResultList item result as output which contains the BASE64 encoded output
The complete code is as follows:
public void encode(String var1[],ResultList result,Container container) throws StreamTransformationException
{
BASE64Encoder encoder=new BASE64Encoder();
String s=null;
byte[] byteArr=null;
try
{
byteArr=encoder.encodeBuffer(var1[0]);
}
catch(Exception e)
{}
s=new String(byteArr);
result.addValue(s);
}
You can use the same basic code in a java mapping as well to suit your requirement after the message mapping is done.
Hope the code helps you .
Thanks
Biswajit
Edited by: 007biswa on Mar 3, 2011 7:54 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.