/** * Construct an AVA. The type and value are normalized : * <li> the type is trimmed and lowercased </li> * <li> the value is trimmed </li> * <p> * Note that the upValue should <b>not</b> be null or empty, or resolved * to an empty string after having trimmed it. * * @param upType The Usrr Provided type * @param normType The normalized type * @param upValue The User Provided value * @param normValue The normalized value */ public AVA( String upType, String normType, byte[] upValue, byte[] normValue ) throws LdapInvalidDnException { this( upType, normType, new BinaryValue( upValue ), new BinaryValue( normValue ) ); }
/** * Get the wrapped value as a byte[]. This method returns a copy of * the wrapped byte[]. * * @return the wrapped value as a byte[] */ public byte[] getBytes() { return get(); }
if ( isNull() ) LdapComparator<byte[]> comparator = getLdapComparator(); .compare( getNormalizedValueReference(), binaryValue.getNormalizedValueReference() ); return new ByteArrayComparator( null ).compare( getNormalizedValueReference(), binaryValue .getNormalizedValueReference() ); String msg = I18n.err( I18n.ERR_04443, Arrays.toString( getReference() ), value ); LOG.error( msg, e ); throw new IllegalStateException( msg, e ); return new ByteArrayComparator( null ).compare( getNormalizedValue(), binaryValue.getNormalizedValue() );
BinaryValue value = new BinaryValue( attributeType, val ); value.normalize();
if ( isNull() ) return other.isNull(); Comparator<byte[]> comparator = (Comparator<byte[]>)getLdapComparator(); return Arrays.equals( getNormalizedValueReference(), other.getNormalizedValueReference() ); return comparator.compare( getNormalizedValueReference(), other.getNormalizedValueReference() ) == 0; return Arrays.equals( getNormalizedValueReference(), other.getNormalizedValueReference() );
if ( binaryValue.getAttributeType() == null ) binaryValue = new BinaryValue( attributeType, (byte[])val.get() );
value = new BinaryValue( attributeType ); ((BinaryValue)value).deserialize( in );
Value<byte[]> nullSV = new BinaryValue( attributeType, (byte[])null ); if ( binaryValue.getAttributeType() == null ) binaryValue = new BinaryValue( attributeType, val.getBytes() );
/** * Sets the attribute value to use in the comparison. * * @param attrVal * the attribute value used in comparison. */ public void setAssertionValue( byte[] attrVal ) { if ( attrVal != null ) { this.attrVal = new BinaryValue( attrVal ); } else { this.attrVal = null; } }
return dumpBytes( ( ( BinaryValue ) object ).get() );
/** * @see EntryAttribute#remove(byte[]...) * * @return <code>true</code> if all the values shave been removed from this attribute */ public boolean remove( byte[]... vals ) { if ( isHR ) { return false; } boolean removed = true; for ( byte[] val:vals ) { BinaryValue value = new BinaryValue( attributeType, val ); removed &= values.remove( value ); } return removed; }
public Object normalizeByOid( String oid, byte[] val ) throws LdapException { return normalizer.normalize( new BinaryValue( val ) ); }
public Object normalizeByName( String name, byte[] val ) throws LdapException { return normalizer.normalize( new BinaryValue( val ) ); }
/** * @see NameComponentNormalizer#normalizeByOid(String, String) */ public Object normalizeByOid( String oid, byte[] value ) throws LdapException { return lookup( oid ).normalize( new BinaryValue( value ) ); }
byte[] upValueBytes = new byte[upValueLength]; in.readFully( upValueBytes ); upValue = new BinaryValue( upValueBytes ); normValue = new BinaryValue( normValueBytes );
BinaryValue value = new BinaryValue( val ); removed &= values.remove( value );
BinaryValue value = new BinaryValue( StringTools.getBytesUtf8( val ) ); removed &= values.remove( value );
new BinaryValue( upValue) , new BinaryValue( normValue ), upName );
public Value<?> normalize( Value<?> value ) throws LdapException { if ( value.isBinary() ) { byte[] val = value.getBytes(); // each byte will be changed to be > 0, and spaces will be trimmed byte[] newVal = new byte[ val.length ]; int i = 0; for ( byte b:val ) { newVal[i++] = (byte)(b & 0x007F); } return new BinaryValue( StringTools.trim( newVal ) ); } throw new IllegalStateException( I18n.err( I18n.ERR_474 ) ); }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public K getNormalized( K attrVal ) throws Exception { if ( attrVal instanceof Long ) { return attrVal; } if ( attrVal instanceof String ) { return ( K ) normalizer.normalize( ( String ) attrVal ); } else { return ( K ) normalizer.normalize( new BinaryValue( ( byte[] ) attrVal ) ).get(); } }