All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.intarsys.tools.jaxb.HexStringAdapter Maven / Gradle / Ivy

There is a newer version: 4.11
Show newest version
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