directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r371305 - in /directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/extended/operations: GracefulDisconnectDecoder.java GracefulShutdownDecoder.java
Date Sun, 22 Jan 2006 14:18:23 GMT
Author: elecharny
Date: Sun Jan 22 06:18:19 2006
New Revision: 371305

URL: http://svn.apache.org/viewcvs?rev=371305&view=rev
Log:
- Change the Copyright date to 2006 in the header
- Added some doco
- called the clean() method after having decoded the PDU

Modified:
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/extended/operations/GracefulDisconnectDecoder.java
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/extended/operations/GracefulShutdownDecoder.java

Modified: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/extended/operations/GracefulDisconnectDecoder.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/extended/operations/GracefulDisconnectDecoder.java?rev=371305&r1=371304&r2=371305&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/extended/operations/GracefulDisconnectDecoder.java
(original)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/extended/operations/GracefulDisconnectDecoder.java
Sun Jan 22 06:18:19 2006
@@ -1,5 +1,5 @@
 /*
- *   Copyright 2005 The Apache Software Foundation
+ *   Copyright 2006 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -31,13 +31,28 @@
  */
 public class GracefulDisconnectDecoder extends Asn1Decoder
 {
+    /** The decoder */
     private static final Asn1Decoder decoder = new Asn1Decoder();
     
-    public Asn1Object decode(byte[] controlBytes) throws DecoderException
+    /**
+     * Decode a PDU which must contain a GracefulDisconnect extended operation.
+     * 
+     * Note that the stream of bytes much contain a full PDU, not a partial one.
+     * 
+     * @param stream The bytes to be decoded
+     * @return An GracefulDisconnect object
+     * @throws DecoderException If the decoding failed
+     */
+    public Asn1Object decode( byte[] stream ) throws DecoderException
     {
-        ByteBuffer bb = ByteBuffer.wrap( controlBytes );
+        ByteBuffer bb = ByteBuffer.wrap( stream );
         GracefulDisconnectContainer container = new GracefulDisconnectContainer();
         decoder.decode( bb, container );
-        return container.getGracefulDisconnect();
+        GracefulDisconnect gracefulDisconnect = container.getGracefulDisconnect();
+        
+        // Clean the container for the next decoding
+        container.clean();
+        
+        return gracefulDisconnect;
     }
 }

Modified: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/extended/operations/GracefulShutdownDecoder.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/extended/operations/GracefulShutdownDecoder.java?rev=371305&r1=371304&r2=371305&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/extended/operations/GracefulShutdownDecoder.java
(original)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/extended/operations/GracefulShutdownDecoder.java
Sun Jan 22 06:18:19 2006
@@ -1,5 +1,5 @@
 /*
- *   Copyright 2005 The Apache Software Foundation
+ *   Copyright 2006 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -31,13 +31,28 @@
  */
 public class GracefulShutdownDecoder extends Asn1Decoder
 {
+    /** The decoder */
     private static final Asn1Decoder decoder = new Asn1Decoder();
     
-    public Asn1Object decode(byte[] controlBytes) throws DecoderException
+    /**
+     * Decode a PDU which must contain a GracefulShutdown extended operation.
+     * 
+     * Note that the stream of bytes much contain a full PDU, not a partial one.
+     * 
+     * @param stream The bytes to be decoded
+     * @return An GracefulShutdown object
+     * @throws DecoderException If the decoding failed
+     */
+    public Asn1Object decode( byte[] stream ) throws DecoderException
     {
-        ByteBuffer bb = ByteBuffer.wrap( controlBytes );
+        ByteBuffer bb = ByteBuffer.wrap( stream );
         GracefulShutdownContainer container = new GracefulShutdownContainer();
         decoder.decode( bb, container );
-        return container.getGracefulShutdown();
+        GracefulShutdown gracefulShutdown = container.getGracefulShutdown();
+        
+        // Clean the container for the next decoding
+        container.clean();
+        
+        return gracefulShutdown;
     }
 }



Mime
View raw message