@Test(expected = IllegalArgumentException.class) public void testNull() { DerId.decode(null); }
public static DerId decode(ByteBuffer buf) { if (buf == null || buf.remaining() == 0) { throw new IllegalArgumentException("Null or empty buffer"); } DerId id = new DerId(); byte first = buf.get(); id.tagClass = TagClass.values()[(first & 0xc0) >> 6]; id.encodingType = EncodingType.values()[(first & 0x20) >> 5]; int tagNum = first & 0x1f; if (tagNum == 0x1F) { if (buf.remaining() == 0) { throw new IllegalArgumentException("Insufficient data to decode tag number greater than 30"); } tagNum = 0; while (buf.hasRemaining()) { byte octet = buf.get(); tagNum = (tagNum << 7) + (octet & 0x7f); if ((octet >> 7) == 0) { break; } } } id.tagNumber = tagNum; return id; }
DerId { public static DerId decode(ByteBuffer buf) { if (buf == null || buf.remaining() == 0) { throw new IllegalArgumentException("Null or empty buffer"); } DerId id = new DerId(); byte first = buf.get(); id.tagClass = TagClass.values()[(first & 0xc0) >> 6]; id.encodingType = EncodingType.values()[(first & 0x20) >> 5]; int tagNum = first & 0x1f; if (tagNum == 0x1F) { if (buf.remaining() == 0) { throw new IllegalArgumentException("Insufficient data to decode tag number greater than 30"); } tagNum = 0; while (buf.hasRemaining()) { byte octet = buf.get(); tagNum = (tagNum << 7) + (octet & 0x7f); if ((octet >> 7) == 0) { break; } } } id.tagNumber = tagNum; return id; } }
DerId { public static DerId decode(ByteBuffer buf) { if (buf == null || buf.remaining() == 0) { throw new IllegalArgumentException("Null or empty buffer"); } DerId id = new DerId(); byte first = buf.get(); id.tagClass = TagClass.values()[(first & 0xc0) >> 6]; id.encodingType = EncodingType.values()[(first & 0x20) >> 5]; int tagNum = first & 0x1f; if (tagNum == 0x1F) { if (buf.remaining() == 0) { throw new IllegalArgumentException("Insufficient data to decode tag number greater than 30"); } tagNum = 0; while (buf.hasRemaining()) { byte octet = buf.get(); tagNum = (tagNum << 7) + (octet & 0x7f); if ((octet >> 7) == 0) { break; } } } id.tagNumber = tagNum; return id; } DerId(); }
DerId { public static DerId decode(ByteBuffer buf) { if (buf == null || buf.remaining() == 0) { throw new IllegalArgumentException("Null or empty buffer"); } DerId id = new DerId(); byte first = buf.get(); id.tagClass = TagClass.values()[(first & 0xc0) >> 6]; id.encodingType = EncodingType.values()[(first & 0x20) >> 5]; int tagNum = first & 0x1f; if (tagNum == 0x1F) { if (buf.remaining() == 0) { throw new IllegalArgumentException("Insufficient data to decode tag number greater than 30"); } tagNum = 0; while (buf.hasRemaining()) { byte octet = buf.get(); tagNum = (tagNum << 7) + (octet & 0x7f); if ((octet >> 7) == 0) { break; } } } id.tagNumber = tagNum; return id; } DerId(); TagClass getTagClass(); EncodingType getEncodingType(); int getTagNumber(); @Override String toString(); static DerId decode(ByteBuffer buf); boolean matches(TagClass tagClass, EncodingType encodingType, int tagNumber); boolean matches(TagClass tagClass, int tagNumber); }
DerId { public static DerId decode(ByteBuffer buf) { if (buf == null || buf.remaining() == 0) { throw new IllegalArgumentException("Null or empty buffer"); } DerId id = new DerId(); byte first = buf.get(); id.tagClass = TagClass.values()[(first & 0xc0) >> 6]; id.encodingType = EncodingType.values()[(first & 0x20) >> 5]; int tagNum = first & 0x1f; if (tagNum == 0x1F) { if (buf.remaining() == 0) { throw new IllegalArgumentException("Insufficient data to decode tag number greater than 30"); } tagNum = 0; while (buf.hasRemaining()) { byte octet = buf.get(); tagNum = (tagNum << 7) + (octet & 0x7f); if ((octet >> 7) == 0) { break; } } } id.tagNumber = tagNum; return id; } DerId(); TagClass getTagClass(); EncodingType getEncodingType(); int getTagNumber(); @Override String toString(); static DerId decode(ByteBuffer buf); boolean matches(TagClass tagClass, EncodingType encodingType, int tagNumber); boolean matches(TagClass tagClass, int tagNumber);  }