use of com.beanit.asn1bean.compiler.tagging_test.ExplicitlyTaggedSet in project jasn1 by openmuc.
the class TaggingTest method explicitlyTaggedSetTest.
@Test
public void explicitlyTaggedSetTest() throws Exception {
ExplicitlyTaggedSet set = new ExplicitlyTaggedSet();
set.setMyInteger(new BerInteger(1));
set.setMyBoolean(new BerBoolean(true));
ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(1000);
set.encode(os);
assertArrayEquals(toBytes("BF210a3108a1030201010101FF"), os.getArray());
set = new ExplicitlyTaggedSet();
set.decode(new ByteArrayInputStream(os.getArray()));
assertNotNull(set.getMyInteger());
assertNotNull(set.getMyBoolean());
}
use of com.beanit.asn1bean.compiler.tagging_test.ExplicitlyTaggedSet in project jasn1 by openmuc.
the class TaggingTest method explicitlyTaggedSetIndefiniteTest.
@Test
public void explicitlyTaggedSetIndefiniteTest() throws Exception {
byte[] code = toBytes("BF21803180a18002010100000101FF00000000");
ExplicitlyTaggedSet set = new ExplicitlyTaggedSet();
InputStream is = new ByteArrayInputStream(code);
int numDecodedBytes = set.decode(is);
assertNotNull(set.getMyInteger());
assertNotNull(set.getMyBoolean());
assertEquals(-1, is.read());
assertEquals(code.length, numDecodedBytes);
}
Aggregations