TlvUtil { public static List<TagAndLength> parseTagAndLength(final byte[] data) { List<TagAndLength> tagAndLengthList = new ArrayList<TagAndLength>(); if (data != null) { TLVInputStream stream = new TLVInputStream(new ByteArrayInputStream(data)); try { while (stream.available() > 0) { if (stream.available() < 2) { throw new TlvException("Data length < 2 : " + stream.available()); } ITag tag = searchTagById(stream.readTag()); int tagValueLength = stream.readLength(); tagAndLengthList.add(new TagAndLength(tag, tagValueLength)); } } catch (IOException e) { LOGGER.error(e.getMessage(), e); } finally { IOUtils.closeQuietly(stream); } } return tagAndLengthList; } private  TlvUtil(); static String getFormattedTagAndLength(final byte[] data, final int indentLength); static TLV getNextTLV(final TLVInputStream stream); static List<TagAndLength> parseTagAndLength(final byte[] data); static String prettyPrintAPDUResponse(final byte[] data); static List<TLV> getlistTLV(final byte[] pData, final ITag pTag, final boolean pAdd); static List<TLV> getlistTLV(final byte[] pData, final ITag... pTag); static byte[] getValue(final byte[] pData, final ITag... pTag); static String prettyPrintAPDUResponse(final byte[] data, final int indentLength); static String getSpaces(final int length); static String prettyPrintHex(final String in, final int indent); static String prettyPrintHex(final byte[] data); static String prettyPrintHex(final String in, final int indent, final boolean wrapLines); static String getSafePrintChars(final byte[] byteArray); static String getSafePrintChars(final byte[] byteArray, final int startPos, final int length); static int getLength(final List<TagAndLength> pList);  }
@Test public void testParseTagAndLength() throws Exception { Assertions.assertThat(TlvUtil.parseTagAndLength(null)).isEqualTo(new ArrayList<TagAndLength>()); }