Search in sources :

Example 16 with BerInteger

use of org.openmuc.jasn1.ber.types.BerInteger in project jasn1 by openmuc.

the class BerIntegerTest method explicitEncoding2.

@Test
public void explicitEncoding2() throws IOException {
    ReverseByteArrayOutputStream berStream = new ReverseByteArrayOutputStream(50);
    BerInteger testInteger = new BerInteger(BigInteger.valueOf(5555));
    int length = testInteger.encode(berStream, true);
    Assert.assertEquals(4, length);
    byte[] expectedBytes = new byte[] { 0x02, 0x02, 0x15, (byte) 0xb3 };
    Assert.assertArrayEquals(expectedBytes, berStream.getArray());
}
Also used : ReverseByteArrayOutputStream(org.openmuc.jasn1.ber.ReverseByteArrayOutputStream) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)15 ReverseByteArrayOutputStream (org.openmuc.jasn1.ber.ReverseByteArrayOutputStream)15 ByteArrayInputStream (java.io.ByteArrayInputStream)12 BerInteger (org.openmuc.jasn1.ber.types.BerInteger)11 BerBoolean (org.openmuc.jasn1.ber.types.BerBoolean)3 ImplicitlyRetaggedTaggedChoice (org.openmuc.jasn1.compiler.tagging_test.ImplicitlyRetaggedTaggedChoice)3 BerAny (org.openmuc.jasn1.ber.types.BerAny)2 RetaggedUntaggedChoice (org.openmuc.jasn1.compiler.tagging_test.RetaggedUntaggedChoice)2 TaggedChoice (org.openmuc.jasn1.compiler.tagging_test.TaggedChoice)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1 BerLength (org.openmuc.jasn1.ber.BerLength)1 BerEmbeddedPdv (org.openmuc.jasn1.ber.types.BerEmbeddedPdv)1 BerVisibleString (org.openmuc.jasn1.ber.types.string.BerVisibleString)1 AbstractSyntaxName (org.openmuc.jasn1.compiler.iso8823_presentation.AbstractSyntaxName)1 CPType (org.openmuc.jasn1.compiler.iso8823_presentation.CPType)1 CalledPresentationSelector (org.openmuc.jasn1.compiler.iso8823_presentation.CalledPresentationSelector)1 CallingPresentationSelector (org.openmuc.jasn1.compiler.iso8823_presentation.CallingPresentationSelector)1