1 10 11 package org.mule.providers.ftp; 12 13 import org.mule.providers.AbstractMessageAdapter; 14 import org.mule.umo.MessagingException; 15 import org.mule.umo.provider.MessageTypeNotSupportedException; 16 17 public class FtpMessageAdapter extends AbstractMessageAdapter 18 { 19 22 private static final long serialVersionUID = 7268290145485349941L; 23 24 private final byte[] message; 25 26 public FtpMessageAdapter(Object message) throws MessagingException 27 { 28 if (message instanceof byte[]) 29 { 30 this.message = (byte[])message; 31 } 32 else 33 { 34 throw new MessageTypeNotSupportedException(message, getClass()); 35 } 36 } 37 38 46 public String getPayloadAsString(String encoding) throws Exception 47 { 48 return new String (message, encoding); 49 } 50 51 public byte[] getPayloadAsBytes() throws Exception 52 { 53 return message; 54 } 55 56 public Object getPayload() 57 { 58 return message; 59 } 60 61 } 62 | Popular Tags |