yy1717
2020-04-03 441c8c2300952c3b809c9b1c2984c1290083c24c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package safeluck.drive.evaluation.platformMessage.decoder;
 
 
import android.util.Log;
 
import com.anyun.im_lib.util.ByteUtil;
import com.safeluck.aykj.decoder.BaseDecoder;
import com.safeluck.aykj.utils.BytesUtils;
 
public class PhoneCoder  extends BaseDecoder<String> {
    private static final String TAG = "PhoneCoder";
    @Override
    public String decode(String str) {
        return str.substring(8);
    }
 
    @Override
    public String encode(String str) {
        if(str==null||"".equalsIgnoreCase(str))
        {
//            str ="00000000000";
            str ="0000000000000000";
        }
        if (str.length()<16){
            str = "0000"+str;
        }
     byte[] bcdBytes = ByteUtil.str2Bcd(str);
//        return "00000"+str;
        return BytesUtils.bytesToHexString(bcdBytes);
    }
}