diff options
author | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2022-02-10 14:00:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-10 14:00:06 +0100 |
commit | 7fe844da786691bf839f169bcab8e71b5021329e (patch) | |
tree | dad727a39dc76d330fe28480e24e8a846c36b760 /src/main/java/org/uic/barcode/asn1 | |
parent | Merge pull request #41 from UnionInternationalCheminsdeFer/1.2.13 (diff) | |
parent | version number update (diff) | |
download | UIC-barcode-1.3.0.tar UIC-barcode-1.3.0.tar.gz UIC-barcode-1.3.0.tar.bz2 UIC-barcode-1.3.0.tar.lz UIC-barcode-1.3.0.tar.xz UIC-barcode-1.3.0.tar.zst UIC-barcode-1.3.0.zip |
Diffstat (limited to '')
15 files changed, 254 insertions, 31 deletions
diff --git a/src/main/java/org/uic/barcode/asn1/uper/AsnExtractor.java b/src/main/java/org/uic/barcode/asn1/uper/AsnExtractor.java new file mode 100644 index 0000000..0d5d1da --- /dev/null +++ b/src/main/java/org/uic/barcode/asn1/uper/AsnExtractor.java @@ -0,0 +1,80 @@ +package org.uic.barcode.asn1.uper;
+
+public class AsnExtractor {
+
+ private String path = null;
+
+ private boolean extractionStarted = false;
+ private boolean extractionCompleted = false;
+
+ private BitBuffer bitBuffer = null;
+ private int startBit = 0;
+ private int endBit = 0;
+
+ AsnExtractor(String path, BitBuffer bitBuffer) {
+ this.path = path;
+ this.bitBuffer = bitBuffer;
+ }
+
+ public byte[] getResult() {
+
+ if (!extractionCompleted) {
+ return null;
+ }
+
+ if (!(endBit > startBit)) {
+ return null;
+ }
+
+ String bitString = bitBuffer.toBooleanString(startBit, endBit - startBit);
+
+ while (bitString.length() % 8 != 0) {
+ bitString = bitString + "0";
+ }
+
+ return AsnUtils.fromBooleanString(bitString);
+
+ }
+
+
+
+ public boolean found(String className) {
+
+ if (extractionStarted || extractionCompleted) return false;
+
+ if (path != null && path.length() > 0 && className != null & className.length() > 0) {
+ if (className.endsWith(path)){
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public void startExtraction(int position) {
+
+ if (path == null || path.length() == 0 || bitBuffer == null) {
+ return;
+ }
+
+ if (!extractionCompleted && !extractionStarted) {
+ extractionStarted = true;
+ startBit = position;
+ }
+ }
+
+ public void endExtraction(int position) {
+ if (extractionStarted) {
+ extractionCompleted = true;
+ endBit = position;
+ }
+
+ }
+
+ public boolean isStarted() {
+ return extractionStarted;
+ }
+
+
+
+}
diff --git a/src/main/java/org/uic/barcode/asn1/uper/AsnUtils.java b/src/main/java/org/uic/barcode/asn1/uper/AsnUtils.java new file mode 100644 index 0000000..414f181 --- /dev/null +++ b/src/main/java/org/uic/barcode/asn1/uper/AsnUtils.java @@ -0,0 +1,75 @@ +package org.uic.barcode.asn1.uper;
+
+import java.math.BigInteger;
+
+public class AsnUtils {
+
+
+ private static byte[] mask = new byte[] {
+ (byte) 0b1000_0000,
+ 0b0100_0000,
+ 0b0010_0000,
+ 0b0001_0000,
+ 0b0000_1000,
+ 0b0000_0100,
+ 0b0000_0010,
+ 0b0000_0001,
+ };
+
+
+ public static byte[] fromBooleanString(final String s) {
+
+ char[] ascii = s.toCharArray();
+ if (ascii == null || ascii.length == 0) {
+ return null;
+ }
+ // get length/8 times bytes with 3 bit shifts to the right of the length
+ final byte[] l_raw = new byte[ascii.length >> 3];
+ /*
+ * We decr index jj by 8 as we go along to not recompute indices using multiplication every time inside the
+ * loop.
+ */
+ for (int ii = 0, jj = 0; ii < l_raw.length; ii++, jj += 8) {
+ for (int bits = 0; bits < mask.length; ++bits) {
+ if (ascii[jj + bits] == '1') {
+ l_raw[ii] |= mask[bits];
+ }
+ }
+ }
+ return l_raw;
+ }
+
+ public static String toBooleanString(byte[] bytes) {
+ StringBuilder sb = new StringBuilder(bytes.length);
+ for (int i = 0; i < bytes.length*8;i++) {
+ sb.append(AsnUtils.get(bytes,i) ? "1" : "0");
+ }
+ return sb.toString();
+ }
+
+ public static boolean get(byte[] bytes, int index) {
+
+ if (index < 0) {
+ throw new IndexOutOfBoundsException("Index " + index + " is less than 0");
+ } else if (index >= bytes.length * 8) {
+ throw new IndexOutOfBoundsException("Index " + index + " violates the limit " + bytes.length*8);
+ }
+ boolean result = (bytes[index / 8] & mask[index % 8]) != 0;
+ return result;
+ }
+
+ public static byte[] shiftBytesToLeft(byte[] bytes, int shift) {
+
+ // create from array
+ BigInteger bigInt = new BigInteger(bytes);
+
+ // shift
+ BigInteger shiftInt = bigInt.shiftLeft(shift);
+
+ // back to array
+ return shiftInt.toByteArray();
+
+ }
+
+
+}
diff --git a/src/main/java/org/uic/barcode/asn1/uper/BitBuffer.java b/src/main/java/org/uic/barcode/asn1/uper/BitBuffer.java index bba0de7..21d0e03 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/BitBuffer.java +++ b/src/main/java/org/uic/barcode/asn1/uper/BitBuffer.java @@ -19,6 +19,7 @@ public interface BitBuffer { BitBuffer flip(); String toBooleanString(int startIndex, int length); String toBooleanStringFromPosition(int startIndex); + byte[] fromBooleanString(String s); byte[] array(); BitBuffer putByte(byte element); byte getByte(); diff --git a/src/main/java/org/uic/barcode/asn1/uper/BitStringCoder.java b/src/main/java/org/uic/barcode/asn1/uper/BitStringCoder.java index 19aac9b..6f435c4 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/BitStringCoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/BitStringCoder.java @@ -97,7 +97,7 @@ class BitStringCoder implements Decoder, Encoder { @Override public <T> T decode(BitBuffer bitbuffer, Class<T> classOfT, Field field, - Annotation[] extraAnnotations) { + Annotation[] extraAnnotations, AsnExtractor extractor) { AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), extraAnnotations); if (!Asn1VarSizeBitstring.class.isAssignableFrom(classOfT)) { diff --git a/src/main/java/org/uic/barcode/asn1/uper/BooleanCoder.java b/src/main/java/org/uic/barcode/asn1/uper/BooleanCoder.java index 3bd7a38..892f851 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/BooleanCoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/BooleanCoder.java @@ -22,7 +22,7 @@ class BooleanCoder implements Decoder, Encoder { @SuppressWarnings("unchecked") @Override public <T> T decode(BitBuffer bitbuffer, Class<T> classOfT, Field field, - Annotation[] extraAnnotations) { + Annotation[] extraAnnotations, AsnExtractor extractor) { Boolean result = new Boolean(bitbuffer.get()); UperEncoder.logger.debug(String.format("BOOL: decoded as %s",result)); return (T) result; diff --git a/src/main/java/org/uic/barcode/asn1/uper/ByteBitBuffer.java b/src/main/java/org/uic/barcode/asn1/uper/ByteBitBuffer.java index 3ed3eed..e409005 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/ByteBitBuffer.java +++ b/src/main/java/org/uic/barcode/asn1/uper/ByteBitBuffer.java @@ -3,7 +3,7 @@ package org.uic.barcode.asn1.uper; public class ByteBitBuffer implements BitBuffer { - + byte[] bytes; byte[] mask = new byte[] { (byte) 0b1000_0000, @@ -45,7 +45,8 @@ public class ByteBitBuffer implements BitBuffer { bytes = newbytes; } - @Override public BitBuffer put(int index, boolean element) { + @Override + public BitBuffer put(int index, boolean element) { if (bytes.length <= index / 8) { if (isFinite) { throw new IndexOutOfBoundsException(); } else { grow(); } @@ -58,21 +59,24 @@ public class ByteBitBuffer implements BitBuffer { return this; } - @Override public BitBuffer put(boolean element) { + @Override + public BitBuffer put(boolean element) { put(position, element); position++; limit = limit < position ? position : limit; // TODO: should it be here? return this; } - @Override public BitBuffer putByte(byte element) { + @Override + public BitBuffer putByte(byte element) { for (int i = 0; i < 8; i++) { put((element & mask[i]) != 0); } return this; } - @Override public BitBuffer putByteArray(int index, byte[] data) { + @Override + public BitBuffer putByteArray(int index, byte[] data) { for (int l = 0; l < data.length;l++) { for (int i = 0; i < 8; i++) { @@ -83,7 +87,8 @@ public class ByteBitBuffer implements BitBuffer { } - @Override public byte getByte() { + @Override + public byte getByte() { byte result = 0; for (int i = 0; i < 8; i++) { result |= (get() ? 1 : 0) << (7 - i); @@ -91,11 +96,13 @@ public class ByteBitBuffer implements BitBuffer { return result; } - @Override public int limit() { + @Override + public int limit() { return limit; } - @Override public String toBooleanString(int startIndex, int length) { + @Override + public String toBooleanString(int startIndex, int length) { StringBuilder sb = new StringBuilder(length); for (int i = startIndex; i < startIndex + length; i++) { sb.append(get(i) ? "1" : "0"); @@ -267,5 +274,12 @@ public class ByteBitBuffer implements BitBuffer { return stringBuilder.toString().trim(); } + + public byte[] fromBooleanString(final String s) { + + return AsnUtils.fromBooleanString(s); + + } + } diff --git a/src/main/java/org/uic/barcode/asn1/uper/ByteCoder.java b/src/main/java/org/uic/barcode/asn1/uper/ByteCoder.java index f26a598..5ecb925 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/ByteCoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/ByteCoder.java @@ -21,7 +21,7 @@ class ByteCoder implements Decoder, Encoder { @SuppressWarnings("unchecked") @Override public <T> T decode(BitBuffer bitbuffer, Class<T> classOfT, Field field, - Annotation[] extraAnnotations) { + Annotation[] extraAnnotations, AsnExtractor extractor) { UperEncoder.logger.debug("BYTE"); return (T) new Byte((byte) UperEncoder.decodeConstrainedInt(bitbuffer, UperEncoder.newRange(0, 255, false))); } diff --git a/src/main/java/org/uic/barcode/asn1/uper/ChoiceCoder.java b/src/main/java/org/uic/barcode/asn1/uper/ChoiceCoder.java index d17a813..0bbce73 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/ChoiceCoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/ChoiceCoder.java @@ -95,7 +95,7 @@ class ChoiceCoder implements Decoder, Encoder { @Override public <T> T decode(BitBuffer bitbuffer, Class<T> classOfT, Field field1, - Annotation[] extraAnnotations) { + Annotation[] extraAnnotations, AsnExtractor extractor) { AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(),extraAnnotations); UperEncoder.logger.debug(String.format("CHOICE: %s", classOfT.getName())); T result = UperEncoder.instantiate(classOfT); @@ -120,7 +120,7 @@ class ChoiceCoder implements Decoder, Encoder { Class<?> classOfElement = field != null ? field.getType() : null; if (field != null) { try { - Object decodedValue = UperEncoder.decodeAsOpenType(bitbuffer, classOfElement,field, field.getAnnotations()); + Object decodedValue = UperEncoder.decodeAsOpenType(bitbuffer, classOfElement,field, field.getAnnotations(),extractor); if (field != null) { field.set(result, decodedValue); } @@ -144,7 +144,7 @@ class ChoiceCoder implements Decoder, Encoder { UperEncoder.newRange(0, sorter.ordinaryFields.size() - 1, false)); Field f = sorter.ordinaryFields.get(index); UperEncoder.logger.debug(String.format("CHOICE: selected %s", f.getName())); - Object fieldValue = UperEncoder.decodeAny(bitbuffer, f.getType(),f, f.getAnnotations()); + Object fieldValue = UperEncoder.decodeAny(bitbuffer, f.getType(),f, f.getAnnotations(),extractor); try { f.set(result, fieldValue); } catch (IllegalArgumentException | IllegalAccessException e) { diff --git a/src/main/java/org/uic/barcode/asn1/uper/Decoder.java b/src/main/java/org/uic/barcode/asn1/uper/Decoder.java index 947a752..3140443 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/Decoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/Decoder.java @@ -5,6 +5,6 @@ import java.lang.reflect.Field; public interface Decoder { <T> boolean canDecode(Class<T> classOfT, Annotation[] extraAnnotations); - <T> T decode(BitBuffer bitbuffer, Class<T> classOfT,Field f, Annotation[] extraAnnotations); + <T> T decode(BitBuffer bitbuffer, Class<T> classOfT,Field f, Annotation[] extraAnnotations,AsnExtractor extractor); <T> T getDefault(Class<T> classOfT, Annotation[] extraAnnotations); } diff --git a/src/main/java/org/uic/barcode/asn1/uper/EnumCoder.java b/src/main/java/org/uic/barcode/asn1/uper/EnumCoder.java index 5d78bc7..3bfdec9 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/EnumCoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/EnumCoder.java @@ -82,7 +82,7 @@ class EnumCoder implements Decoder, Encoder { @Override public <T> T decode(BitBuffer bitbuffer, Class<T> classOfT, Field field, - Annotation[] extraAnnotations) { + Annotation[] extraAnnotations, AsnExtractor extractor) { AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), extraAnnotations); UperEncoder.logger.debug("ENUM"); boolean extensionPresent = false; diff --git a/src/main/java/org/uic/barcode/asn1/uper/IntCoder.java b/src/main/java/org/uic/barcode/asn1/uper/IntCoder.java index 5964a64..e5e48c1 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/IntCoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/IntCoder.java @@ -27,7 +27,7 @@ class IntCoder implements Encoder, Decoder { @Override public <T> T decode(BitBuffer bitbuffer, Class<T> classOfT, Field field, - Annotation[] extraAnnotations) { + Annotation[] extraAnnotations, AsnExtractor extractor) { AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(),extraAnnotations); String pos = String.format("Position: %d.%d", bitbuffer.position()/8 , bitbuffer.position() % 8); UperEncoder.logger.debug(String.format("%s: INTEGER",pos)); diff --git a/src/main/java/org/uic/barcode/asn1/uper/SeqOfCoder.java b/src/main/java/org/uic/barcode/asn1/uper/SeqOfCoder.java index a7ae7ba..d0ce782 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/SeqOfCoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/SeqOfCoder.java @@ -96,7 +96,7 @@ class SeqOfCoder implements Decoder, Encoder { @SuppressWarnings("unchecked") @Override public <T> T decode(BitBuffer bitbuffer, Class<T> classOfT,Field field, - Annotation[] extraAnnotations) { + Annotation[] extraAnnotations, AsnExtractor extractor) { AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), extraAnnotations); UperEncoder.logger.debug(String.format("SEQUENCE OF for %s", classOfT)); @@ -135,7 +135,7 @@ class SeqOfCoder implements Decoder, Encoder { } } for (int i = 0; i < size; i++) { - coll.add(UperEncoder.decodeAny(bitbuffer, classOfElements,field, annotationArray)); + coll.add(UperEncoder.decodeAny(bitbuffer, classOfElements,field, annotationArray, extractor)); } T result = null; diff --git a/src/main/java/org/uic/barcode/asn1/uper/SequenceCoder.java b/src/main/java/org/uic/barcode/asn1/uper/SequenceCoder.java index ce89a3e..3af7217 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/SequenceCoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/SequenceCoder.java @@ -150,13 +150,24 @@ class SequenceCoder implements Decoder, Encoder { @Override public <T> T decode(BitBuffer bitbuffer, Class<T> classOfT,Field f1, - Annotation[] extraAnnotations) { + Annotation[] extraAnnotations, + AsnExtractor extractor) { UperEncoder.logger.debug(String.format("decode SEQUENCE %s",classOfT.getSimpleName())); AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(),extraAnnotations); T result = UperEncoder.instantiate(classOfT); - Asn1ContainerFieldSorter sorter = new Asn1ContainerFieldSorter(classOfT); + Asn1ContainerFieldSorter sorter = new Asn1ContainerFieldSorter(classOfT); boolean hasExtensionMarker = UperEncoder.hasExtensionMarker(annotations); boolean extensionPresent = false; + + //check Extraction + boolean extract = false; + if (extractor != null && !extractor.isStarted() && extractor.found(classOfT.getCanonicalName())) { + extractor.startExtraction(bitbuffer.position()); + extract = true; + } + + + //start decodong if (hasExtensionMarker) { extensionPresent = bitbuffer.get(); UperEncoder.logger.debug(String.format("with extension marker, extension %s", extensionPresent ? "present!" : "absent")); @@ -175,7 +186,7 @@ class SequenceCoder implements Decoder, Encoder { (UperEncoder.isOptional(f) && optionalFieldsMask.pop()))) { UperEncoder.logger.debug(String.format("Field : %s", f.getName())); try { - f.set(result, UperEncoder.decodeAny(bitbuffer,f.getType(),f, f.getAnnotations())); + f.set(result, UperEncoder.decodeAny(bitbuffer,f.getType(),f, f.getAnnotations(),extractor)); } catch (IllegalAccessException e) { throw new IllegalArgumentException("can't access 'set method' for field " + f + " of class " + classOfT + " " + e, e); } @@ -196,6 +207,11 @@ class SequenceCoder implements Decoder, Encoder { if (!hasExtensionMarker) { //done sorter.revertAccess(); + + if (extract) { + extractor.endExtraction(bitbuffer.position()); + } + return result; } @@ -222,7 +238,7 @@ class SequenceCoder implements Decoder, Encoder { Class<?> classOfElement = field != null ? field.getType() : null; if (field != null) { try { - Object decodedValue = UperEncoder.decodeAsOpenType(bitbuffer, classOfElement,field, field.getAnnotations()); + Object decodedValue = UperEncoder.decodeAsOpenType(bitbuffer, classOfElement,field, field.getAnnotations(),extractor); if (field != null) { field.set(result, decodedValue); } @@ -269,6 +285,11 @@ class SequenceCoder implements Decoder, Encoder { } // end of extension handling } sorter.revertAccess(); + + if (extract) { + extractor.endExtraction(bitbuffer.position()); + } + return result; } diff --git a/src/main/java/org/uic/barcode/asn1/uper/StringCoder.java b/src/main/java/org/uic/barcode/asn1/uper/StringCoder.java index 349e988..a504096 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/StringCoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/StringCoder.java @@ -150,7 +150,7 @@ class StringCoder implements Decoder, Encoder { @Override public <T> T decode(BitBuffer bitbuffer, Class<T> classOfT, Field field, - Annotation[] extraAnnotations) { + Annotation[] extraAnnotations, AsnExtractor extractor) { UperEncoder.logger.debug("decode String"); AnnotationStore annotations = new AnnotationStore(classOfT.getAnnotations(), extraAnnotations); RestrictedString restrictionAnnotation = annotations.getAnnotation(RestrictedString.class); diff --git a/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java b/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java index d5c5d1e..c256b4f 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java @@ -66,7 +66,7 @@ public final class UperEncoder { public static <T> T decode(byte[] bytes, Class<T> classOfT) throws IllegalArgumentException, UnsupportedOperationException { BitBuffer bitQueue = bitBufferFromBinaryString(binaryStringFromBytes(bytes)); - T result = decodeAny(bitQueue, classOfT,null, new Annotation[] {}); + T result = decodeAny(bitQueue, classOfT,null, new Annotation[] {}, null); if (bitQueue.remaining() > 7) { throw new IllegalArgumentException("Can't fully decode " + classOfT.getName() + ", got (" + result.getClass().getName() + "): " + result @@ -74,11 +74,43 @@ public final class UperEncoder { } return result; } + + public static <T> T decode(byte[] bytes, Class<T> classOfT,AsnExtractor extractor) throws IllegalArgumentException, + UnsupportedOperationException { + BitBuffer bitQueue = bitBufferFromBinaryString(binaryStringFromBytes(bytes)); + T result = decodeAny(bitQueue, classOfT,null, new Annotation[] {}, extractor); + if (bitQueue.remaining() > 7) { + throw new IllegalArgumentException("Can't fully decode " + + classOfT.getName() + ", got (" + result.getClass().getName() + "): " + result + + "; remaining " + bitQueue.remaining() + " bits: " + bitQueue); + } + return result; + } + + + public static <T> byte[] extract(byte[] bytes,String path,Class<T> classOfT) throws IllegalArgumentException, UnsupportedOperationException { + + BitBuffer bitQueue = bitBufferFromBinaryString(binaryStringFromBytes(bytes)); + + AsnExtractor extractor = new AsnExtractor(path,bitQueue); + + T result = decodeAny(bitQueue, classOfT,null, new Annotation[] {}, extractor); + if (bitQueue.remaining() > 7) { + throw new IllegalArgumentException("Can't fully decode " + + classOfT.getName() + ", got (" + result.getClass().getName() + "): " + result + + "; remaining " + bitQueue.remaining() + " bits: " + bitQueue); + } + return extractor.getResult(); + } + + + + - public static <T> T decode(byte[] bytes, Class<T> classOfT, Field f) throws IllegalArgumentException, + public static <T> T decode(byte[] bytes, Class<T> classOfT, Field f,AsnExtractor extractor) throws IllegalArgumentException, UnsupportedOperationException { BitBuffer bitQueue = bitBufferFromBinaryString(binaryStringFromBytes(bytes)); - T result = decodeAny(bitQueue, classOfT, f, new Annotation[] {}); + T result = decodeAny(bitQueue, classOfT, f, new Annotation[] {}, extractor); if (bitQueue.remaining() > 7) { throw new IllegalArgumentException("Can't fully decode " + classOfT.getName() + ", got (" + result.getClass().getName() + "): " + result @@ -108,13 +140,13 @@ public final class UperEncoder { + " with extra annotations " + Arrays.asList(extraAnnotations)); } - static <T> T decodeAny(BitBuffer bitbuffer,Class<T> classOfT, Field f, Annotation[] extraAnnotations) { + static <T> T decodeAny(BitBuffer bitbuffer,Class<T> classOfT, Field f, Annotation[] extraAnnotations, AsnExtractor extractor) { logger.debug(String.format(String.format("Decoding classOfT : %s",classOfT.getCanonicalName()))); for (Decoder e : decoders) { if (e.canDecode(classOfT, extraAnnotations)) { - return e.decode(bitbuffer, classOfT,f, extraAnnotations); + return e.decode(bitbuffer, classOfT,f, extraAnnotations,extractor); } } @@ -216,7 +248,7 @@ public final class UperEncoder { } - static <T> T decodeAsOpenType(BitBuffer bitbuffer, Class<T> classOfT,Field f, Annotation[] extraAnnotations) { + static <T> T decodeAsOpenType(BitBuffer bitbuffer, Class<T> classOfT,Field f, Annotation[] extraAnnotations,AsnExtractor extractor) { logger.debug(String.format("OPEN TYPE for %s. Encoding preceedes length determinant", classOfT != null ? classOfT.getName() : "null")); long numBytes = decodeLengthDeterminant(bitbuffer); BitBuffer openTypeBitBuffer = ByteBitBuffer.allocate((int)numBytes * 8); @@ -225,7 +257,7 @@ public final class UperEncoder { } openTypeBitBuffer.flip(); if (classOfT != null) { - T result = decodeAny(openTypeBitBuffer, classOfT, f, extraAnnotations); + T result = decodeAny(openTypeBitBuffer, classOfT, f, extraAnnotations, extractor); // Assert that padding bits are all 0. logger.debug(String.format("open type had padding bits")); for (int i = 0; i < openTypeBitBuffer.remaining(); i++) { |