de.timroes.axmlrpc.serializer.Base64Serializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aXMLRPC Show documentation
Show all versions of aXMLRPC Show documentation
Lightweight Java XML-RPC working also on Android.
package de.timroes.axmlrpc.serializer;
import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.XMLUtil;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import de.timroes.base64.Base64;
import org.w3c.dom.Element;
/**
*
* @author Tim Roes
*/
public class Base64Serializer implements Serializer {
public Object deserialize(Element content) throws XMLRPCException {
return Base64.decode(XMLUtil.getOnlyTextContent(content.getChildNodes()));
}
public XmlElement serialize(Object object) {
return XMLUtil.makeXmlTag(SerializerHandler.TYPE_BASE64,
Base64.encode((Byte[])object));
}
}