directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1035585 - in /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber: AbstractContainer.java Asn1Container.java
Date Tue, 16 Nov 2010 11:02:53 GMT
Author: elecharny
Date: Tue Nov 16 11:02:53 2010
New Revision: 1035585

URL: http://svn.apache.org/viewvc?rev=1035585&view=rev
Log:
Added a rewind(TLV) method to be able to move back to the start of a TLV in the stream.

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Container.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java?rev=1035585&r1=1035584&r2=1035585&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
Tue Nov 16 11:02:53 2010
@@ -298,4 +298,13 @@ public abstract class AbstractContainer 
         this.stream = stream;
     }
 
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void rewind( TLV tlv )
+    {
+        int start = stream.position() - 1 - tlv.getLengthNbBytes();
+        stream.position( start );
+    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Container.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Container.java?rev=1035585&r1=1035584&r2=1035585&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Container.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Container.java
Tue Nov 16 11:02:53 2010
@@ -178,4 +178,13 @@ public interface Asn1Container
      * replaced by the max integer value)
      */
     void setMaxPDUSize( int maxPDUSize );
+    
+    
+    /**
+     * Move backward in the stream to the first byte for a given TLV. This is useful when
we have
+     * read some Tag and Length in order to define the next transition, and if this transition
+     * do a grammar switch.
+     * @param tlv The TLV to rollback
+     */
+    void rewind( TLV tlv );
 }



Mime
View raw message