summaryrefslogtreecommitdiffstats
path: root/src/org/uic/header/DynamicHeader.java
diff options
context:
space:
mode:
authorCGantert345 <57003061+CGantert345@users.noreply.github.com>2020-04-30 15:47:00 +0200
committerCGantert345 <57003061+CGantert345@users.noreply.github.com>2020-04-30 15:47:00 +0200
commit59f77a4623e066c5a903c3fd35777774368c6d21 (patch)
tree7fa13e45356d4312af66316d02728516b95bec7d /src/org/uic/header/DynamicHeader.java
parentformat default added (diff)
downloadUIC-barcode-59f77a4623e066c5a903c3fd35777774368c6d21.tar
UIC-barcode-59f77a4623e066c5a903c3fd35777774368c6d21.tar.gz
UIC-barcode-59f77a4623e066c5a903c3fd35777774368c6d21.tar.bz2
UIC-barcode-59f77a4623e066c5a903c3fd35777774368c6d21.tar.lz
UIC-barcode-59f77a4623e066c5a903c3fd35777774368c6d21.tar.xz
UIC-barcode-59f77a4623e066c5a903c3fd35777774368c6d21.tar.zst
UIC-barcode-59f77a4623e066c5a903c3fd35777774368c6d21.zip
Diffstat (limited to 'src/org/uic/header/DynamicHeader.java')
-rw-r--r--src/org/uic/header/DynamicHeader.java38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/org/uic/header/DynamicHeader.java b/src/org/uic/header/DynamicHeader.java
index 05e06eb..011fe19 100644
--- a/src/org/uic/header/DynamicHeader.java
+++ b/src/org/uic/header/DynamicHeader.java
@@ -1,5 +1,7 @@
package org.uic.header;
+import org.uic.ticket.api.asn.omv1.UicRailTicketData;
+
import net.gcdc.asn1.datatypes.Asn1Optional;
import net.gcdc.asn1.datatypes.CharacterRestriction;
import net.gcdc.asn1.datatypes.HasExtensionMarker;
@@ -7,13 +9,14 @@ import net.gcdc.asn1.datatypes.IntRange;
import net.gcdc.asn1.datatypes.RestrictedString;
import net.gcdc.asn1.datatypes.Sequence;
import net.gcdc.asn1.datatypesimpl.OctetString;
+import net.gcdc.asn1.uper.UperEncoder;
+// TODO: Auto-generated Javadoc
/**
* The DynamicHeader for bar codes
*
- * Implementation of the Draft under discussion, not final
- *
+ * Implementation of the Draft under discussion, not final.
*/
@Sequence
@HasExtensionMarker
@@ -37,9 +40,7 @@ public class DynamicHeader {
@IntRange(minValue=1,maxValue=32000)
@Asn1Optional public Long securityProviderNum;
- /** The security provider
- * alphanumeric codes
- */
+ /** The security provider alphanumeric codes. */
@RestrictedString(CharacterRestriction.IA5String)
@Asn1Optional public String securityProviderIA5;
@@ -86,7 +87,7 @@ public class DynamicHeader {
/**
* Sets the version.
*
- * @param vesion the new version
+ * @param version the new version
*/
public void setVersion(Long version) {
this.version = version;
@@ -199,6 +200,31 @@ public class DynamicHeader {
public void setExtension(Extension extension) {
this.extension = extension;
}
+
+
+ /**
+ * Encode.
+ *
+ * Encode the header as ASN.1 PER UNALIGNED byte array
+ *
+ * @return the byte[]
+ */
+ public byte[] encode() {
+ return UperEncoder.encode(this);
+ }
+
+ /**
+ * Decode.
+ *
+ * Decode the header from an ASN.1 PER UNALIGNED encoded byte array
+ *
+ * @param bytes the bytes
+ * @return the dynamic header
+ */
+ public static DynamicHeader decode(byte[] bytes) {
+ return UperEncoder.decode(bytes, DynamicHeader.class);
+ }
+
}