summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/uic/barcode/dynamicFrame/v1/DataType.java
blob: 6195b3c515688116740f2776d16f76ca9d9d2f59 (plain) (blame)
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
package org.uic.barcode.dynamicFrame.v1;

import org.uic.barcode.asn1.datatypes.CharacterRestriction;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypesimpl.OctetString;
import org.uic.barcode.asn1.uper.UperEncoder;

/**
 * The Class DataType.
 */
@Sequence
public class DataType {


	/** The data format.
	 * 
	 *  -- FCB1  FCB version 1
	 *  -- FCB2  FCB version 2
	 *  -- RICS  company code + ...
	 **/
	@RestrictedString(CharacterRestriction.IA5String)
	public String format;
	
	/** The data. */
	public OctetString data;

	/**
	 * Gets the data format.
	 *
	 * @return the data format
	 */
	public String getFormat() {
		return format;
	}

	/**
	 * Sets the data format.
	 *
	 * @param dataFormat the new data format
	 */
	public void setFormat(String format) {
		this.format = format;
	}

	/**
	 * Gets the data.
	 *
	 * @return the data
	 */
	public OctetString getData() {
		return data;
	}

	/**
	 * Sets the data.
	 *
	 * @param data the new data
	 */
	public void setData(OctetString data) {
		this.data = data;
	}
	
	/**
	 * Gets the data as byte array.
	 *
	 * @return the data
	 */
	public byte[] getByteData() {
		return data.toByteArray();
	}

	/**
	 * Sets the data from a byte array.
	 *
	 * @param data the new data
	 */
	public void setByteData(byte[] data) {
		this.data = new OctetString(data);
	}
	
	/**
	 * Encode.
	 * 
	 * Encode the header as ASN.1 PER UNALIGNED byte array
	 *
	 * @return the byte[]
	 */
	public byte[] encode() {
		return UperEncoder.encode(this);
	}

}