package com.safeluck.aykj.decoder;
|
|
import com.safeluck.aykj.utils.BytesUtils;
|
|
/**
|
* Created by zhouwei on 2016/12/1.
|
*/
|
public class ByteCoder extends BaseDecoder<Integer> {
|
public static ByteCoder instance = new ByteCoder();
|
@Override
|
public Integer decode(String str) {
|
if(str==null||"".equals(str))
|
return 0;
|
return Integer.valueOf(str, 16).intValue();
|
}
|
|
@Override
|
public String encode(Integer i) {
|
if(i==null)
|
i=0;
|
return BytesUtils.toHexString(i.byteValue());
|
}
|
|
}
|