Examples of TLV


Examples of org.apache.directory.shared.asn1.ber.tlv.TLV

    /**
     * {@inheritDoc}
     */
    public final void action( E container ) throws DecoderException
    {
        TLV tlv = container.getCurrentTLV();

        // The Length should not be null
        if ( tlv.getLength() == 0 )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        Value value = tlv.getValue();

        try
        {
            int number = IntegerDecoder.parse( value, minValue, maxValue );

View Full Code Here

Examples of org.apache.directory.shared.asn1.ber.tlv.TLV

    /**
     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<MessageDecorator<? extends Message>> container ) throws DecoderException
    {
        TLV tlv = container.getCurrentTLV();

        MessageDecorator<?> message = container.getMessage();
        CodecControl<? extends Control> control = message.getCurrentControl();

        // Get the current control
        Value value = tlv.getValue();

        // Store the value - have to handle the special case of a 0 length value
        if ( tlv.getLength() == 0 )
        {
            control.setValue( StringConstants.EMPTY_BYTES );
        }
        else
        {
View Full Code Here

Examples of org.apache.directory.shared.asn1.ber.tlv.TLV

     * value has been decoded, <code>END</code> if whe still need to get some
     * more bytes.
     */
    private boolean treatValuePendingState( ByteBuffer stream, Asn1Container container )
    {
        TLV currentTlv = container.getCurrentTLV();

        int length = currentTlv.getLength();
        int currentLength = currentTlv.getValue().getCurrentLength();
        int nbBytes = stream.remaining();

        if ( ( currentLength + nbBytes ) < length )
        {
            currentTlv.getValue().addData( stream );
            container.setState( TLVStateEnum.VALUE_STATE_PENDING );

            return END;
        }
        else
        {
            int remaining = length - currentLength;
            byte[] data = new byte[remaining];
            stream.get( data, 0, remaining );
            currentTlv.getValue().addData( data );
            container.setState( TLVStateEnum.TLV_STATE_DONE );

            return MORE;
        }
    }
View Full Code Here

Examples of org.apache.directory.shared.asn1.ber.tlv.TLV

    /**
     * {@inheritDoc}
     */
    public final void action( C container ) throws DecoderException
    {
        TLV tlv = container.getCurrentTLV();

        // The Length should not be null
        if ( ( tlv.getLength() == 0 ) && ( !canBeNull ) )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        Value value = tlv.getValue();

        // The data should not be null
        if ( ( value.getData() == null ) && ( !canBeNull ) )
        {
            LOG.error( I18n.err( I18n.ERR_04066 ) );
View Full Code Here

Examples of org.apache.directory.shared.asn1.ber.tlv.TLV

    {
        BindRequest bindRequestMessage = container.getMessage();

        // The current TLV should be a integer between 1 and 127
        // We get it and store it in Version
        TLV tlv = container.getCurrentTLV();

        Value value = tlv.getValue();

        try
        {
            int version = IntegerDecoder.parse( value, 1, 127 );
View Full Code Here

Examples of org.nfctools.mf.tlv.Tlv

  public static void outputNdefMessage(MfUlReaderWriter readerWriter, MemoryLayout memoryLayout) {
    TypeLengthValueReader reader = new TypeLengthValueReader(new TagInputStream(memoryLayout, readerWriter));

    while (reader.hasNext()) {
      Tlv tlv = reader.next();
      if (tlv instanceof NdefMessageTlv) {
        NdefMessage ndefMessage = decoder.decode(((NdefMessageTlv)tlv).getNdefMessage());
        for (Record record : decoder.decodeToRecords(ndefMessage)) {
          System.out.println(record);
        }
View Full Code Here

Examples of org.smpp.pdu.tlv.TLV

    throws NotEnoughDataInByteBufferException, UnexpectedOptionalParameterException, TLVException {
    short tag;
    short length;
    ByteBuffer tlvHeader;
    ByteBuffer tlvBuf;
    TLV tlv = null;
    while (buffer.length() > 0) {
      // we prepare buffer with one parameter
      tlvHeader = buffer.readBytes(Data.TLV_HEADER_SIZE);
      tag = tlvHeader.removeShort();
      tlv = findOptional(optionalParameters, tag);
      if (tlv == null) {
        // ok, got extra optional parameter not defined in SMPP spec
        // will keep it as octets
        tlv = new TLVOctets(tag);
        registerExtraOptional(tlv);
      }
      length = tlvHeader.removeShort();
      tlvBuf = buffer.removeBuffer(Data.TLV_HEADER_SIZE + length);
      tlv.setData(tlvBuf);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.