de.intarsys.tools.jaxb.HexStringAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of isrt Show documentation
Show all versions of isrt Show documentation
The basic runtime tools and interfaces for intarsys components.
package de.intarsys.tools.jaxb;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import de.intarsys.tools.hex.HexTools;
/**
* Convert a hex string notation to a String (UTF-8)
*
*/
public class HexStringAdapter extends XmlAdapter {
@Override
public String marshal(String v) throws Exception {
return HexTools.bytesToHexString(v.getBytes("UTF-8"));
}
@Override
public String unmarshal(String v) throws Exception {
return new String(HexTools.hexStringToBytes(v), "UTF-8");
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy