@Test public void testChoiceWithSameTypedOptions() throws Exception { ChoiceWithThreeSequenceOptions c = parse("3000", ChoiceWithThreeSequenceOptions.class); assertNotNull(c.s1); assertNull(c.s2); assertNull(c.s3); c = parse("a000", ChoiceWithThreeSequenceOptions.class); assertNull(c.s1); assertNotNull(c.s2); assertNull(c.s3); c = parse("a1023000", ChoiceWithThreeSequenceOptions.class); assertNull(c.s1); assertNull(c.s2); assertNotNull(c.s3); try { parse("02010a", ChoiceWithThreeSequenceOptions.class); fail(); } catch (Asn1DecodingException expected) {} }
public static <T> T parse(ByteBuffer encoded, Class<T> containerClass) throws Asn1DecodingException { BerDataValue containerDataValue; try { containerDataValue = new ByteBufferBerDataValueReader(encoded).readDataValue(); } catch (BerDataValueFormatException e) { throw new Asn1DecodingException("Failed to decode top-level data value", e); } if (containerDataValue == null) { throw new Asn1DecodingException("Empty input"); } return parse(containerDataValue, containerClass); }
Asn1BerParser { public static <T> T parse(ByteBuffer encoded, Class<T> containerClass) throws Asn1DecodingException { BerDataValue containerDataValue; try { containerDataValue = new ByteBufferBerDataValueReader(encoded).readDataValue(); } catch (BerDataValueFormatException e) { throw new Asn1DecodingException("Failed to decode top-level data value", e); } if (containerDataValue == null) { throw new Asn1DecodingException("Empty input"); } return parse(containerDataValue, containerClass); } }
Asn1BerParser { public static <T> T parse(ByteBuffer encoded, Class<T> containerClass) throws Asn1DecodingException { BerDataValue containerDataValue; try { containerDataValue = new ByteBufferBerDataValueReader(encoded).readDataValue(); } catch (BerDataValueFormatException e) { throw new Asn1DecodingException("Failed to decode top-level data value", e); } if (containerDataValue == null) { throw new Asn1DecodingException("Empty input"); } return parse(containerDataValue, containerClass); } private  Asn1BerParser(); }
Asn1BerParser { public static <T> T parse(ByteBuffer encoded, Class<T> containerClass) throws Asn1DecodingException { BerDataValue containerDataValue; try { containerDataValue = new ByteBufferBerDataValueReader(encoded).readDataValue(); } catch (BerDataValueFormatException e) { throw new Asn1DecodingException("Failed to decode top-level data value", e); } if (containerDataValue == null) { throw new Asn1DecodingException("Empty input"); } return parse(containerDataValue, containerClass); } private  Asn1BerParser(); static T parse(ByteBuffer encoded, Class<T> containerClass); static List<T> parseImplicitSetOf(ByteBuffer encoded, Class<T> elementClass); }
Asn1BerParser { public static <T> T parse(ByteBuffer encoded, Class<T> containerClass) throws Asn1DecodingException { BerDataValue containerDataValue; try { containerDataValue = new ByteBufferBerDataValueReader(encoded).readDataValue(); } catch (BerDataValueFormatException e) { throw new Asn1DecodingException("Failed to decode top-level data value", e); } if (containerDataValue == null) { throw new Asn1DecodingException("Empty input"); } return parse(containerDataValue, containerClass); } private  Asn1BerParser(); static T parse(ByteBuffer encoded, Class<T> containerClass); static List<T> parseImplicitSetOf(ByteBuffer encoded, Class<T> elementClass);  }