/** * A debug function used to dump the expected length stack. * * @param tlv The current TLV. * @return A string which represent the expected length stack. */ private String getParentLength( TLV tlv ) { StringBuilder buffer = new StringBuilder(); buffer.append( "TLV expected length stack : " ); TLV currentTlv = tlv; while ( true ) { if ( currentTlv == null ) { buffer.append( " - null" ); break; } else { buffer.append( " - " ).append( currentTlv.getExpectedLength() ); } currentTlv = currentTlv.getParent(); } return buffer.toString(); }
/** * A debug function used to dump the expected length stack. * * @param tlv The current TLV. * @return A string which represent the expected length stack. */ private String getParentLength( TLV tlv ) { StringBuilder buffer = new StringBuilder(); buffer.append( "TLV expected length stack : " ); TLV currentTlv = tlv; while ( true ) { if ( currentTlv == null ) { buffer.append( " - null" ); break; } else { buffer.append( " - " ).append( currentTlv.getExpectedLength() ); } currentTlv = currentTlv.getParent(); } return buffer.toString(); }
/** * {@inheritDoc} */ @Override public void updateParent() { TLV parentTlv = tlv.getParent(); while ( ( parentTlv != null ) && ( parentTlv.getExpectedLength() == 0 ) ) { parentTlv = parentTlv.getParent(); } this.parentTLV = parentTlv; }
/** * {@inheritDoc} */ @Override public void updateParent() { TLV parentTlv = tlv.getParent(); while ( ( parentTlv != null ) && ( parentTlv.getExpectedLength() == 0 ) ) { parentTlv = parentTlv.getParent(); } this.parentTLV = parentTlv; }
/** * Dump the current TLV tree * * @param container The container */ private void dumpTLVTree( Asn1Container container ) { StringBuilder sb = new StringBuilder(); TLV current = container.getCurrentTLV(); sb.append( "TLV" ).append( Asn1StringUtils.dumpByte( current.getTag() ) ).append( "(" ).append( current.getExpectedLength() ).append( ")" ); current = current.getParent(); while ( current != null ) { sb.append( "-TLV" ).append( Asn1StringUtils.dumpByte( current.getTag() ) ).append( "(" ).append( current.getExpectedLength() ).append( ")" ); current = current.getParent(); } if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_01001_TLV_TREE, sb.toString() ) ); } }
/** * Dump the current TLV tree * * @param container The container */ private void dumpTLVTree( Asn1Container container ) { StringBuilder sb = new StringBuilder(); TLV current = container.getCurrentTLV(); sb.append( "TLV" ).append( Asn1StringUtils.dumpByte( current.getTag() ) ).append( "(" ).append( current.getExpectedLength() ).append( ")" ); current = current.getParent(); while ( current != null ) { sb.append( "-TLV" ).append( Asn1StringUtils.dumpByte( current.getTag() ) ).append( "(" ).append( current.getExpectedLength() ).append( ")" ); current = current.getParent(); } if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_01001_TLV_TREE, sb.toString() ) ); } }
/** * Check if the TLV tree is fully decoded * * @param container The container * @return <code>true</code> if the TLV has been decoded */ private boolean isTLVDecoded( Asn1Container container ) { TLV current = container.getCurrentTLV(); TLV parent = current.getParent(); while ( parent != null ) { if ( parent.getExpectedLength() != 0 ) { return false; } parent = parent.getParent(); } BerValue value = current.getValue(); if ( ( value != null ) && ( value.getData() != null ) ) { return current.getExpectedLength() == value.getData().length; } else { return current.getExpectedLength() == 0; } }
/** * Check if the TLV tree is fully decoded * * @param container The container * @return <code>true</code> if the TLV has been decoded */ private boolean isTLVDecoded( Asn1Container container ) { TLV current = container.getCurrentTLV(); TLV parent = current.getParent(); while ( parent != null ) { if ( parent.getExpectedLength() != 0 ) { return false; } parent = parent.getParent(); } BerValue value = current.getValue(); if ( ( value != null ) && ( value.getData() != null ) ) { return current.getExpectedLength() == value.getData().length; } else { return current.getExpectedLength() == 0; } }
int expectedLength = parentTLV.getExpectedLength(); int currentLength = tlv.getSize(); if ( parentTLV.getExpectedLength() != 0 ) if ( parentTLV.getExpectedLength() != 0 )
int expectedLength = parentTLV.getExpectedLength(); int currentLength = tlv.getSize(); if ( parentTLV.getExpectedLength() != 0 ) if ( parentTLV.getExpectedLength() != 0 )
while ( ( localParent != null ) && ( localParent.getExpectedLength() == 0 ) )
while ( ( localParent != null ) && ( localParent.getExpectedLength() == 0 ) )
while ( ( localParent != null ) && ( localParent.getExpectedLength() == 0 ) )