@Test(groups = "asn1", dataProvider = "oids") public void decode(final byte[] bytes, final String expected) throws Exception { Assert.assertEquals(OidType.decode(new DefaultDERBuffer(bytes)), expected); }
public static String decode(final DERBuffer encoded) { final StringBuilder sb = new StringBuilder(); final int firstId = encoded.get(); if (firstId < 40) { sb.append("0").append(".").append(firstId).append("."); } else if (firstId < 80) { sb.append("1").append(".").append(firstId - 40).append("."); } else { sb.append("2").append(".").append(firstId - 80).append("."); } while (encoded.hasRemaining()) { sb.append(readInt(encoded)).append("."); } sb.setLength(sb.length() - 1); return sb.toString(); }
OidType extends AbstractDERType implements DEREncoder { public static String decode(final DERBuffer encoded) { final StringBuilder sb = new StringBuilder(); final int firstId = encoded.get(); if (firstId < 40) { sb.append("0").append(".").append(firstId).append("."); } else if (firstId < 80) { sb.append("1").append(".").append(firstId - 40).append("."); } else { sb.append("2").append(".").append(firstId - 80).append("."); } while (encoded.hasRemaining()) { sb.append(readInt(encoded)).append("."); } sb.setLength(sb.length() - 1); return sb.toString(); } }
OidType extends AbstractDERType implements DEREncoder { public static String decode(final DERBuffer encoded) { final StringBuilder sb = new StringBuilder(); final int firstId = encoded.get(); if (firstId < 40) { sb.append("0").append(".").append(firstId).append("."); } else if (firstId < 80) { sb.append("1").append(".").append(firstId - 40).append("."); } else { sb.append("2").append(".").append(firstId - 80).append("."); } while (encoded.hasRemaining()) { sb.append(readInt(encoded)).append("."); } sb.setLength(sb.length() - 1); return sb.toString(); } OidType(final String item);  OidType(final int[] item);  OidType(final DERTag tag, final String item);  OidType(final DERTag tag, final int[] item); }
OidType extends AbstractDERType implements DEREncoder { public static String decode(final DERBuffer encoded) { final StringBuilder sb = new StringBuilder(); final int firstId = encoded.get(); if (firstId < 40) { sb.append("0").append(".").append(firstId).append("."); } else if (firstId < 80) { sb.append("1").append(".").append(firstId - 40).append("."); } else { sb.append("2").append(".").append(firstId - 80).append("."); } while (encoded.hasRemaining()) { sb.append(readInt(encoded)).append("."); } sb.setLength(sb.length() - 1); return sb.toString(); } OidType(final String item);  OidType(final int[] item);  OidType(final DERTag tag, final String item);  OidType(final DERTag tag, final int[] item); @Override byte[] encode(); static String decode(final DERBuffer encoded); static byte[] toBytes(final int[] oid); static int[] parse(final String oid); }
OidType extends AbstractDERType implements DEREncoder { public static String decode(final DERBuffer encoded) { final StringBuilder sb = new StringBuilder(); final int firstId = encoded.get(); if (firstId < 40) { sb.append("0").append(".").append(firstId).append("."); } else if (firstId < 80) { sb.append("1").append(".").append(firstId - 40).append("."); } else { sb.append("2").append(".").append(firstId - 80).append("."); } while (encoded.hasRemaining()) { sb.append(readInt(encoded)).append("."); } sb.setLength(sb.length() - 1); return sb.toString(); } OidType(final String item);  OidType(final int[] item);  OidType(final DERTag tag, final String item);  OidType(final DERTag tag, final int[] item); @Override byte[] encode(); static String decode(final DERBuffer encoded); static byte[] toBytes(final int[] oid); static int[] parse(final String oid);  }