@Test(expectedExceptions = TLVParserException.class, expectedExceptionsMessageRegExp = "Reading TLV bytes failed") public void testCreateTlvElementFromNokBytes_ExpectedTlvParserException() throws Exception { TLVElement.create(new byte[]{0x0, 2, 0x0}); }
public static TLVElement create(byte[] bytes) throws TLVParserException { Util.notNull(bytes, "Byte array"); TLVInputStream input = null; try { input = new TLVInputStream(new ByteArrayInputStream(bytes)); TLVElement element = input.readElement(); if (input.hasNextElement()) { throw new MultipleTLVElementException(); } return element; } catch (IOException e) { throw new TLVParserException("Reading TLV bytes failed", e); } finally { Util.closeQuietly(input); } }
TLVElement { public static TLVElement create(byte[] bytes) throws TLVParserException { Util.notNull(bytes, "Byte array"); TLVInputStream input = null; try { input = new TLVInputStream(new ByteArrayInputStream(bytes)); TLVElement element = input.readElement(); if (input.hasNextElement()) { throw new MultipleTLVElementException(); } return element; } catch (IOException e) { throw new TLVParserException("Reading TLV bytes failed", e); } finally { Util.closeQuietly(input); } } }
TLVElement { public static TLVElement create(byte[] bytes) throws TLVParserException { Util.notNull(bytes, "Byte array"); TLVInputStream input = null; try { input = new TLVInputStream(new ByteArrayInputStream(bytes)); TLVElement element = input.readElement(); if (input.hasNextElement()) { throw new MultipleTLVElementException(); } return element; } catch (IOException e) { throw new TLVParserException("Reading TLV bytes failed", e); } finally { Util.closeQuietly(input); } } TLVElement(boolean nonCritical, boolean forwarded, int type);  TLVElement(boolean inputTlv16, boolean nonCritical, boolean forwarded, int type); }
TLVElement { public static TLVElement create(byte[] bytes) throws TLVParserException { Util.notNull(bytes, "Byte array"); TLVInputStream input = null; try { input = new TLVInputStream(new ByteArrayInputStream(bytes)); TLVElement element = input.readElement(); if (input.hasNextElement()) { throw new MultipleTLVElementException(); } return element; } catch (IOException e) { throw new TLVParserException("Reading TLV bytes failed", e); } finally { Util.closeQuietly(input); } } TLVElement(boolean nonCritical, boolean forwarded, int type);  TLVElement(boolean inputTlv16, boolean nonCritical, boolean forwarded, int type); static TLVElement create(byte[] bytes); static TLVElement create(int type, long value); static TLVElement create(int type, Date value); static TLVElement create(int type, DataHash value); static TLVElement create(int type, String value); static TLVElement create(int type, byte[] value); static TLVElement create(int type, HashAlgorithm value); final Long getDecodedLong(); final String getDecodedString(); final DataHash getDecodedDataHash(); final Date getDecodedDate(); HashAlgorithm getDecodedHashAlgorithm(); byte[] getContent(); void setContent(byte[] content); void setStringContent(String s); void setLongContent(long value); void setDataHashContent(DataHash dataHash); void setDateContent(Date date); void setHashAlgorithmContent(HashAlgorithm hashAlgorithm); TLVElement getFirstChildElement(int tag); TLVElement getFirstChildElement(); TLVElement getLastChildElement(); List<TLVElement> getChildElements(int tag); List<TLVElement> getChildElements(); List<TLVElement> getChildElements(int... tags); int getType(); void setType(int type); boolean isOutputTlv16(); boolean isInputTlv16(); boolean isNonCritical(); boolean isForwarded(); byte[] encodeHeader(); int getContentLength(); int getHeaderLength(); void replace(TLVElement childToBeReplaced, TLVElement newChild); void remove(TLVElement elementToRemoved); void addChildElement(TLVElement element); void addFirstChildElement(TLVElement element); void writeTo(OutputStream out); byte[] getEncoded(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
TLVElement { public static TLVElement create(byte[] bytes) throws TLVParserException { Util.notNull(bytes, "Byte array"); TLVInputStream input = null; try { input = new TLVInputStream(new ByteArrayInputStream(bytes)); TLVElement element = input.readElement(); if (input.hasNextElement()) { throw new MultipleTLVElementException(); } return element; } catch (IOException e) { throw new TLVParserException("Reading TLV bytes failed", e); } finally { Util.closeQuietly(input); } } TLVElement(boolean nonCritical, boolean forwarded, int type);  TLVElement(boolean inputTlv16, boolean nonCritical, boolean forwarded, int type); static TLVElement create(byte[] bytes); static TLVElement create(int type, long value); static TLVElement create(int type, Date value); static TLVElement create(int type, DataHash value); static TLVElement create(int type, String value); static TLVElement create(int type, byte[] value); static TLVElement create(int type, HashAlgorithm value); final Long getDecodedLong(); final String getDecodedString(); final DataHash getDecodedDataHash(); final Date getDecodedDate(); HashAlgorithm getDecodedHashAlgorithm(); byte[] getContent(); void setContent(byte[] content); void setStringContent(String s); void setLongContent(long value); void setDataHashContent(DataHash dataHash); void setDateContent(Date date); void setHashAlgorithmContent(HashAlgorithm hashAlgorithm); TLVElement getFirstChildElement(int tag); TLVElement getFirstChildElement(); TLVElement getLastChildElement(); List<TLVElement> getChildElements(int tag); List<TLVElement> getChildElements(); List<TLVElement> getChildElements(int... tags); int getType(); void setType(int type); boolean isOutputTlv16(); boolean isInputTlv16(); boolean isNonCritical(); boolean isForwarded(); byte[] encodeHeader(); int getContentLength(); int getHeaderLength(); void replace(TLVElement childToBeReplaced, TLVElement newChild); void remove(TLVElement elementToRemoved); void addChildElement(TLVElement element); void addFirstChildElement(TLVElement element); void writeTo(OutputStream out); byte[] getEncoded(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static final int MAX_TLV16_CONTENT_LENGTH; }