You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2016/06/17 21:55:07 UTC
svn commit: r1748893 -
/directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/SearchRequestDecorator.java
Author: elecharny
Date: Fri Jun 17 21:55:07 2016
New Revision: 1748893
URL: http://svn.apache.org/viewvc?rev=1748893&view=rev
Log:
Speeding up the encoding of a Search Request
Modified:
directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/SearchRequestDecorator.java
Modified: directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/SearchRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/SearchRequestDecorator.java?rev=1748893&r1=1748892&r2=1748893&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/SearchRequestDecorator.java (original)
+++ directory/shared/branches/shared-value/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/SearchRequestDecorator.java Fri Jun 17 21:55:07 2016
@@ -103,6 +103,9 @@ public class SearchRequestDecorator exte
/** The bytes containing the Dn */
private byte[] dnBytes;
+
+ /** The Attribute Name's bytes */
+ private byte[][] attributeNameBytes;
/**
@@ -934,12 +937,17 @@ public class SearchRequestDecorator exte
if ( ( getAttributes() != null ) && ( getAttributes().size() != 0 ) )
{
+ attributeNameBytes = new byte[getAttributes().size()][];
+ int attributeNb = 0;
+
// Compute the attributes length
for ( String attribute : getAttributes() )
{
// add the attribute length to the attributes length
- int idLength = Strings.getBytesUtf8( attribute ).length;
+ attributeNameBytes[attributeNb] = Strings.getBytesUtf8( attribute );
+ int idLength = attributeNameBytes[attributeNb].length;
attributeDescriptionListLength += 1 + TLV.getNbBytes( idLength ) + idLength;
+ attributeNb++;
}
}
@@ -1007,9 +1015,9 @@ public class SearchRequestDecorator exte
if ( ( getAttributes() != null ) && ( getAttributes().size() != 0 ) )
{
// encode each attribute
- for ( String attribute : getAttributes() )
+ for ( byte[] attributeBytes : attributeNameBytes )
{
- BerValue.encode( buffer, attribute );
+ BerValue.encode( buffer, attributeBytes );
}
}
}