@Test public void encode() { codec.encode(expectedUint); assertThat(codec.getBytes()).isEqualTo(this.expectedEncodedBytes); }
@Override public void encode(final BigInteger value) { if (value.compareTo(BigInteger.ZERO) < 0) { throw new IllegalArgumentException("value must be positive or zero"); } byte[] bytes = value.toByteArray(); if (bytes[0] == 0x00 && bytes.length > 1) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write(bytes, 1, bytes.length - 1); setBytes(baos.toByteArray()); return; } setBytes(bytes); }
AsnUintCodec extends AsnOctetStringBasedObjectCodec<BigInteger> { @Override public void encode(final BigInteger value) { if (value.compareTo(BigInteger.ZERO) < 0) { throw new IllegalArgumentException("value must be positive or zero"); } byte[] bytes = value.toByteArray(); if (bytes[0] == 0x00 && bytes.length > 1) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write(bytes, 1, bytes.length - 1); setBytes(baos.toByteArray()); return; } setBytes(bytes); } }
AsnUintCodec extends AsnOctetStringBasedObjectCodec<BigInteger> { @Override public void encode(final BigInteger value) { if (value.compareTo(BigInteger.ZERO) < 0) { throw new IllegalArgumentException("value must be positive or zero"); } byte[] bytes = value.toByteArray(); if (bytes[0] == 0x00 && bytes.length > 1) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write(bytes, 1, bytes.length - 1); setBytes(baos.toByteArray()); return; } setBytes(bytes); } AsnUintCodec(); }
AsnUintCodec extends AsnOctetStringBasedObjectCodec<BigInteger> { @Override public void encode(final BigInteger value) { if (value.compareTo(BigInteger.ZERO) < 0) { throw new IllegalArgumentException("value must be positive or zero"); } byte[] bytes = value.toByteArray(); if (bytes[0] == 0x00 && bytes.length > 1) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write(bytes, 1, bytes.length - 1); setBytes(baos.toByteArray()); return; } setBytes(bytes); } AsnUintCodec(); @Override BigInteger decode(); @Override void encode(final BigInteger value); }
AsnUintCodec extends AsnOctetStringBasedObjectCodec<BigInteger> { @Override public void encode(final BigInteger value) { if (value.compareTo(BigInteger.ZERO) < 0) { throw new IllegalArgumentException("value must be positive or zero"); } byte[] bytes = value.toByteArray(); if (bytes[0] == 0x00 && bytes.length > 1) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write(bytes, 1, bytes.length - 1); setBytes(baos.toByteArray()); return; } setBytes(bytes); } AsnUintCodec(); @Override BigInteger decode(); @Override void encode(final BigInteger value);  }