Package org.apache.directory.shared.ldap.model.entry

Examples of org.apache.directory.shared.ldap.model.entry.BinaryValue


        }
        else
        {
            if ( value instanceof StringValue )
            {
                return new BinaryValue( attributeType, ( ( StringValue ) value ).getBytes() );
            }
        }

        return null;
    }
View Full Code Here


                List<Value<?>> binaries = new ArrayList<Value<?>>();

                for ( Value<?> value : attribute )
                {
                    attribute.add( value );
                    binaries.add( new BinaryValue( attribute.getAttributeType(), value.getBytes() ) );
                }

                attribute.clear();

                for ( Value<?> value : binaries )
View Full Code Here

        }
        else
        {
            if ( value instanceof String )
            {
                val = new BinaryValue( attributeType, Strings.getBytesUtf8((String) value) );
            }
            else if ( value instanceof byte[] )
            {
                val = new BinaryValue( attributeType, ( byte[] ) value );
            }
            else
            {
                throw new LdapException( I18n.err( I18n.ERR_309, oid ) );
            }
View Full Code Here

                normalized = ( K ) attributeType.getEquality().getNormalizer().normalize( ( String ) attrVal );
            }
            else
            {
                normalized = ( K ) attributeType.getEquality().getNormalizer().normalize(
                    new BinaryValue( ( byte[] ) attrVal ) ).getValue();
            }

            // Double map it so if we use an already normalized
            // value we can get back the same normalized value.
            // and not have to regenerate a second time.
View Full Code Here

                    for ( byte b:val )
                    {
                        newVal[i++] = (byte)(b & 0x007F);
                    }
                   
                    return new BinaryValue( Strings.trim(newVal) );
                }

                throw new IllegalStateException();
            }
View Full Code Here

        schemaManager = new DefaultSchemaManager();
        cn = schemaManager.getAttributeType( "cn" );
        dc = schemaManager.getAttributeType( "dc" );
        userCertificate = schemaManager.getAttributeType( "userCertificate" );
       
        bv1 = new BinaryValue( userCertificate, data );
        bv2 = new BinaryValue( userCertificate, StringConstants.EMPTY_BYTES );
        bv3 = new BinaryValue( userCertificate, null );
        bv1n = new BinaryValue( userCertificate, data );
        bv2n = new BinaryValue( userCertificate, StringConstants.EMPTY_BYTES );
        bv3n = new BinaryValue( userCertificate, null );
        sv1 = new StringValue( cn, "test" );
        sv2 = new StringValue( dc, "" );
        sv3 = new StringValue( dc, (String)null );
        sv1n = new StringValue( cn, "test" );
        sv2n = new StringValue( dc, "" );
View Full Code Here

        ObjectInputStream in = null;

        byte[] data = baos.toByteArray();
        in = new ObjectInputStream( new ByteArrayInputStream( data ) );

        BinaryValue bvDeser = BinaryValue.deserialize( in );

        assertEquals( bv1, bvDeser );
    }
View Full Code Here

        ObjectInputStream in = null;

        byte[] data = baos.toByteArray();
        in = new ObjectInputStream( new ByteArrayInputStream( data ) );

        BinaryValue bvDeser = BinaryValue.deserialize( in );

        assertEquals( bv2, bvDeser );
    }
View Full Code Here

        ObjectInputStream in = null;

        byte[] data = baos.toByteArray();
        in = new ObjectInputStream( new ByteArrayInputStream( data ) );

        BinaryValue bvDeser = BinaryValue.deserialize( in );

        assertEquals( bv3, bvDeser );
    }
View Full Code Here

        ObjectInputStream in = null;

        byte[] data = baos.toByteArray();
        in = new ObjectInputStream( new ByteArrayInputStream( data ) );

        BinaryValue bvDeser = BinaryValue.deserialize( userCertificate, in );

        assertEquals( bv1n, bvDeser );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.entry.BinaryValue

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.