左晓为主开发手持机充值管理机
zuoxiao
2024-04-25 8d53327d1b3df1aea5f9eb9fa22c644ccfeeabf1
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package com.dayu.baselibrary.bean;
 
import android.os.Parcel;
import android.os.Parcelable;
 
/**
 * 打印相关
 */
public class TransBean implements Parcelable {
 
    private byte type = 0;
    private String text = "";
    private byte[] data = null;
    private int datalength = 0;
    
    public TransBean(){
        type = 0;
        data = null;
        text = "";
        datalength = 0;        
    };
    
    public byte getType() {
        return type;
    }
 
    public void setType(byte type) {
        this.type = type;
    }
 
    public String getText() {
        return text;
    }
 
    public void setText(String text) {
        this.text = text;
    }
 
    public byte[] getData() {
        return data;
    }
 
    public void setData(byte[] data) {
        if(data != null){
            datalength = data.length;
            this.data = new byte[datalength];
            System.arraycopy(data, 0, this.data, 0, datalength);
        }
    }
 
    public TransBean(Parcel source){
        this.type = source.readByte();
        this.datalength = source.readInt();
        this.text = source.readString();
        if(datalength > 0){
            this.data = new byte[datalength];
            source.readByteArray(data);
        }
    }
    
    public TransBean(byte type, String text, byte[] data){
        this.type = type;
        this.text = text;
        if(data != null){
            this.datalength = data.length;
            this.data = new byte[datalength];
            System.arraycopy(data, 0, this.data, 0, datalength);
        }
    }
    
    @Override
    public int describeContents() {
        return 0;
    }
 
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByte(type);
        dest.writeInt(datalength);
        dest.writeString(text);
        if(data != null){
            dest.writeByteArray(data);
        }
    }
    
    public static Creator<TransBean> CREATOR = new Creator<TransBean>(){
 
        @Override
        public TransBean createFromParcel(Parcel source) {
            return new TransBean(source);
        }
 
        @Override
        public TransBean[] newArray(int size) {
            return new TransBean[size];
        }        
    };
 
}