Package org.apache.directory.shared.asn1

Examples of org.apache.directory.shared.asn1.Encoder


        // a FF, it's a TRUE. Any other value should be an error,
        // but we could relax this constraint. So if we have
        // something
        // which is not 0, it will be interpreted as TRUE, but we
        // will generate a warning.
        Value value = tlv.getValue();

        try
        {
            modifyDnRequest.setDeleteOldRdn( BooleanDecoder.parse( value ) );
        }
        catch ( BooleanDecoderException bde )
        {
            LOG.error( I18n
                .err( I18n.ERR_04091, Strings.dumpBytes( value.getData() ), bde.getMessage() ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( bde.getMessage() );
        }
View Full Code Here


            // 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 );

            if ( IS_DEBUG )
            {
                LOG.debug( "read integer value : {}", number );
            }

            setIntegerValue( number, container );
        }
        catch ( IntegerDecoderException ide )
        {
            LOG.error( I18n.err( I18n.ERR_04070, Strings.dumpBytes( value.getData() ), ide
                .getLocalizedMessage() ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( ide.getMessage(), ide );
        }
View Full Code Here

        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
        {
            control.setValue( value.getData() );

            if ( control != null )
            {
                control.decode( value.getData() );
            }
        }

        // We can have an END transition
        container.setGrammarEndAllowed( true );
View Full Code Here

            }

            parent = parent.getParent();
        }

        Value value = current.getValue();

        if ( ( value != null ) && ( value.getData() != null ) )
        {
            return ( current.getExpectedLength() == value.getData().length );
        }
        else
        {
            return current.getExpectedLength() == 0;
        }
View Full Code Here

     */
    public ExtendedResponse extended( String oid, byte[] value ) throws LdapException
    {
        try
        {
            return extended( new Oid( oid ), value );
        }
        catch ( DecoderException e )
        {
            String msg = "Failed to decode the OID " + oid;
            LOG.error( msg );
View Full Code Here

    pHandler.startElement("", VALUE_TAG, VALUE_TAG, ZERO_ATTRIBUTES);
    pHandler.startElement("", BASE_64_TAG, BASE_64_TAG, ZERO_ATTRIBUTES);
    byte[] buffer = (byte[]) pObject;
    if (buffer.length > 0) {
      char[] charBuffer = new char[buffer.length >= 1024 ? 1024 : ((buffer.length+3)/4)*4];
      Encoder encoder = new Base64.SAXEncoder(charBuffer, 0, null, pHandler);
      try {
        encoder.write(buffer, 0, buffer.length);
        encoder.flush();
      } catch (Base64.SAXIOException e) {
        throw e.getSAXException();
      } catch (IOException e) {
        throw new SAXException(e);
      }
View Full Code Here

  public void write(final ContentHandler pHandler, Object pObject) throws SAXException {
    pHandler.startElement("", VALUE_TAG, VALUE_TAG, ZERO_ATTRIBUTES);
    pHandler.startElement("", SERIALIZABLE_TAG, EX_SERIALIZABLE_TAG, ZERO_ATTRIBUTES);
    char[] buffer = new char[1024];
    Encoder encoder = new Base64.SAXEncoder(buffer, 0, null, pHandler);
    try {
      OutputStream ostream = new EncoderOutputStream(encoder);
      ObjectOutputStream oos = new ObjectOutputStream(ostream);
      oos.writeObject(pObject);
      oos.close();
View Full Code Here

    pHandler.startElement("", VALUE_TAG, VALUE_TAG, ZERO_ATTRIBUTES);
    pHandler.startElement("", BASE_64_TAG, BASE_64_TAG, ZERO_ATTRIBUTES);
    byte[] buffer = (byte[]) pObject;
    if (buffer.length > 0) {
      char[] charBuffer = new char[buffer.length >= 1024 ? 1024 : ((buffer.length+3)/4)*4];
      Encoder encoder = new Base64.SAXEncoder(charBuffer, 0, null, pHandler);
      try {
        encoder.write(buffer, 0, buffer.length);
        encoder.flush();
      } catch (Base64.SAXIOException e) {
        throw e.getSAXException();
      } catch (IOException e) {
        throw new SAXException(e);
      }
View Full Code Here

  public void write(final ContentHandler pHandler, Object pObject) throws SAXException {
    pHandler.startElement("", VALUE_TAG, VALUE_TAG, ZERO_ATTRIBUTES);
    pHandler.startElement("", SERIALIZABLE_TAG, EX_SERIALIZABLE_TAG, ZERO_ATTRIBUTES);
    char[] buffer = new char[1024];
    Encoder encoder = new Base64.SAXEncoder(buffer, 0, null, pHandler);
    try {
      OutputStream ostream = new EncoderOutputStream(encoder);
      ObjectOutputStream oos = new ObjectOutputStream(ostream);
      oos.writeObject(pObject);
      oos.close();
View Full Code Here

  public void write(final ContentHandler pHandler, Object pObject) throws SAXException {
    pHandler.startElement("", VALUE_TAG, VALUE_TAG, ZERO_ATTRIBUTES);
    pHandler.startElement("", BASE_64_TAG, BASE_64_TAG, ZERO_ATTRIBUTES);
    byte[] buffer = (byte[]) pObject;
    char[] charBuffer = new char[buffer.length >= 1024 ? 1024 : ((buffer.length+3)/4)*4];
    Encoder encoder = new Base64.SAXEncoder(charBuffer, 0, null, pHandler);
    try {
      encoder.write(buffer, 0, buffer.length);
      encoder.flush();
    } catch (Base64.SAXIOException e) {
      throw e.getSAXException();
    } catch (IOException e) {
      throw new SAXException(e);
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.asn1.Encoder

Copyright © 2018 www.massapicom. 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.