summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/uic/barcode/ssbFrame/SsbNonUic.java
blob: 28e5105df61bb3225eeeac9c479aeafac5e3b89c (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
package org.uic.barcode.ssbFrame;

import org.uic.barcode.asn1.uper.AsnUtils;
import org.uic.barcode.asn1.uper.BitBuffer;
import org.uic.barcode.asn1.uper.ByteBitBuffer;

public class SsbNonUic extends SsbTicketPart {
	
	byte[] openData = null;

	@Override
	protected void decodeContent(byte[] bytes) {
		
		String bitString = AsnUtils.toBooleanString(bytes);
				
		openData = AsnUtils.fromBooleanString(bitString);
		
	}

	@Override
	protected void encodeContent(byte[] bytes) {
		
		BitBuffer bits = new ByteBitBuffer(bytes);
		
		String bitString = AsnUtils.toBooleanString(openData);
		
		for (int i = 0;i< 58 *8 ;i++) {
			if (bitString.charAt(i) == '0') {
				bits.put(27 + i, true);
			} else {
				bits.put(27 + i, false);
			}
		}
	}

	public byte[] getOpenData() {
		return openData;
	}

	public void setOpenData(byte[] openData) {
		this.openData = openData;
	}
	
	
	
}