com.jn.agileway.codec.serialization.xson.XsonCodec Maven / Gradle / Ivy
package com.jn.agileway.codec.serialization.xson;
import com.jn.agileway.codec.AbstractCodec;
import com.jn.agileway.codec.CodecException;
public class XsonCodec extends AbstractCodec {
@Override
public byte[] encode(T obj) throws CodecException {
try {
return Xsons.serialize(obj);
} catch (Throwable ex) {
throw new CodecException(ex.getMessage(), ex);
}
}
@Override
public T decode(byte[] bytes) throws CodecException {
return decode(bytes, getTargetType());
}
@Override
public T decode(byte[] bytes, Class targetType) throws CodecException {
return Xsons.deserialize(bytes, targetType);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy