yy1717
2021-02-07 cea2a94fc97e79897cdfd217be8250c075974a1a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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());
    }
 
}