@Test(expectedExceptions = EOFException.class) public void testReadTlvElementFromEmptyStream() throws Exception { input = new TLVInputStream(new ByteArrayInputStream(new byte[]{})); input.readElement(); }
public TLVElement readElement() throws IOException, TLVParserException { TlvHeader header = readHeader(); TLVElement element = new TLVElement(header.tlv16, header.nonCritical, header.forwarded, header.type); int count = countNestedTlvElements(header); if (count > 0) { readNestedElements(element, count); } else { element.setContent(readTlvContent(header)); } return element; }
TLVInputStream extends InputStream { public TLVElement readElement() throws IOException, TLVParserException { TlvHeader header = readHeader(); TLVElement element = new TLVElement(header.tlv16, header.nonCritical, header.forwarded, header.type); int count = countNestedTlvElements(header); if (count > 0) { readNestedElements(element, count); } else { element.setContent(readTlvContent(header)); } return element; } }
TLVInputStream extends InputStream { public TLVElement readElement() throws IOException, TLVParserException { TlvHeader header = readHeader(); TLVElement element = new TLVElement(header.tlv16, header.nonCritical, header.forwarded, header.type); int count = countNestedTlvElements(header); if (count > 0) { readNestedElements(element, count); } else { element.setContent(readTlvContent(header)); } return element; } TLVInputStream(final InputStream stream); }
TLVInputStream extends InputStream { public TLVElement readElement() throws IOException, TLVParserException { TlvHeader header = readHeader(); TLVElement element = new TLVElement(header.tlv16, header.nonCritical, header.forwarded, header.type); int count = countNestedTlvElements(header); if (count > 0) { readNestedElements(element, count); } else { element.setContent(readTlvContent(header)); } return element; } TLVInputStream(final InputStream stream); TLVElement readElement(); boolean hasNextElement(); int read(); @Override void close(); }
TLVInputStream extends InputStream { public TLVElement readElement() throws IOException, TLVParserException { TlvHeader header = readHeader(); TLVElement element = new TLVElement(header.tlv16, header.nonCritical, header.forwarded, header.type); int count = countNestedTlvElements(header); if (count > 0) { readNestedElements(element, count); } else { element.setContent(readTlvContent(header)); } return element; } TLVInputStream(final InputStream stream); TLVElement readElement(); boolean hasNextElement(); int read(); @Override void close(); static final int TLV16_HEADER_LENGTH; static final int TLV8_HEADER_LENGTH; }