@Test public void decode() { codec = new AsnUintCodecUL(); codec.setBytes(new byte[]{1}); assertThat(codec.decode()).isEqualTo(UnsignedLong.ONE); }
@Override public UnsignedLong decode() { try { return UnsignedLong.valueOf(new BigInteger(1, getBytes())); } catch (Exception e) { if (defaultValue.isPresent()) { logger.warn( "Variable Unsigned Integer was too big for VarUInt: {}. Returning UnsignedLong.Max", Base64.getEncoder().encodeToString(getBytes()) ); return defaultValue.get(); } else { throw e; } } }
AsnUintCodecUL extends AsnOctetStringBasedObjectCodec<UnsignedLong> { @Override public UnsignedLong decode() { try { return UnsignedLong.valueOf(new BigInteger(1, getBytes())); } catch (Exception e) { if (defaultValue.isPresent()) { logger.warn( "Variable Unsigned Integer was too big for VarUInt: {}. Returning UnsignedLong.Max", Base64.getEncoder().encodeToString(getBytes()) ); return defaultValue.get(); } else { throw e; } } } }
AsnUintCodecUL extends AsnOctetStringBasedObjectCodec<UnsignedLong> { @Override public UnsignedLong decode() { try { return UnsignedLong.valueOf(new BigInteger(1, getBytes())); } catch (Exception e) { if (defaultValue.isPresent()) { logger.warn( "Variable Unsigned Integer was too big for VarUInt: {}. Returning UnsignedLong.Max", Base64.getEncoder().encodeToString(getBytes()) ); return defaultValue.get(); } else { throw e; } } } AsnUintCodecUL();  AsnUintCodecUL(final UnsignedLong defaultValue); }
AsnUintCodecUL extends AsnOctetStringBasedObjectCodec<UnsignedLong> { @Override public UnsignedLong decode() { try { return UnsignedLong.valueOf(new BigInteger(1, getBytes())); } catch (Exception e) { if (defaultValue.isPresent()) { logger.warn( "Variable Unsigned Integer was too big for VarUInt: {}. Returning UnsignedLong.Max", Base64.getEncoder().encodeToString(getBytes()) ); return defaultValue.get(); } else { throw e; } } } AsnUintCodecUL();  AsnUintCodecUL(final UnsignedLong defaultValue); @Override UnsignedLong decode(); @Override void encode(final UnsignedLong value); }
AsnUintCodecUL extends AsnOctetStringBasedObjectCodec<UnsignedLong> { @Override public UnsignedLong decode() { try { return UnsignedLong.valueOf(new BigInteger(1, getBytes())); } catch (Exception e) { if (defaultValue.isPresent()) { logger.warn( "Variable Unsigned Integer was too big for VarUInt: {}. Returning UnsignedLong.Max", Base64.getEncoder().encodeToString(getBytes()) ); return defaultValue.get(); } else { throw e; } } } AsnUintCodecUL();  AsnUintCodecUL(final UnsignedLong defaultValue); @Override UnsignedLong decode(); @Override void encode(final UnsignedLong value);  }