You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/05/29 08:55:53 UTC

svn commit: r1682372 - /tomcat/trunk/java/org/apache/coyote/ajp/AjpMessage.java

Author: markt
Date: Fri May 29 06:55:52 2015
New Revision: 1682372

URL: http://svn.apache.org/r1682372
Log:
Javadoc (with a little related code clean-up)

Modified:
    tomcat/trunk/java/org/apache/coyote/ajp/AjpMessage.java

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpMessage.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpMessage.java?rev=1682372&r1=1682371&r2=1682372&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpMessage.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpMessage.java Fri May 29 06:55:52 2015
@@ -112,6 +112,8 @@ public class AjpMessage {
 
     /**
      * Return the underlying byte buffer.
+     *
+     * @return The buffer
      */
     public byte[] getBuffer() {
         return buf;
@@ -119,9 +121,11 @@ public class AjpMessage {
 
 
     /**
-     * Return the current message length. For read, it's the length of the
-     * payload (excluding the header).  For write, it's the length of
-     * the packet as a whole (counting the header).
+     * Return the current message length.
+     *
+     * @return For read, it's the length of the payload (excluding the header).
+     * For write, it's the length of the packet as a whole (counting the
+     * header).
      */
     public int getLen() {
         return len;
@@ -130,6 +134,8 @@ public class AjpMessage {
 
     /**
      * Add a short integer (2 bytes) to the message.
+     *
+     * @param val The integer to append
      */
     public void appendInt(int val) {
         buf[pos++] = (byte) ((val >>> 8) & 0xFF);
@@ -139,6 +145,8 @@ public class AjpMessage {
 
     /**
      * Append a byte (1 byte) to the message.
+     *
+     * @param val The byte value to append
      */
     public void appendByte(int val) {
         buf[pos++] = (byte) val;
@@ -146,8 +154,10 @@ public class AjpMessage {
 
 
     /**
-     * Write a MessageBytes out at the current write position.
-     * A null MessageBytes is encoded as a string with length 0.
+     * Write a MessageBytes out at the current write position. A null
+     * MessageBytes is encoded as a string with length 0.
+     *
+     * @param mb The data to write
      */
     public void appendBytes(MessageBytes mb) {
         if (mb == null) {
@@ -181,8 +191,10 @@ public class AjpMessage {
 
 
     /**
-     * Write a ByteChunk out at the current write position.
-     * A null ByteChunk is encoded as a string with length 0.
+     * Write a ByteChunk out at the current write position. A null ByteChunk is
+     * encoded as a string with length 0.
+     *
+     * @param bc The data to write
      */
     public void appendByteChunk(ByteChunk bc) {
         if (bc == null) {
@@ -228,6 +240,8 @@ public class AjpMessage {
      * it.  Integers are encoded as two unsigned bytes with the
      * high-order byte first, and, as far as I can tell, in
      * little-endian order within each byte.
+     *
+     * @return The integer value read from the message
      */
     public int getInt() {
         int b1 = buf[pos++] & 0xFF;
@@ -285,6 +299,8 @@ public class AjpMessage {
      * it.  Integers are encoded as four unsigned bytes with the
      * high-order byte first, and, as far as I can tell, in
      * little-endian order within each byte.
+     *
+     * @return The long value read from the message
      */
     public int getLongInt() {
         int b1 = buf[pos++] & 0xFF; // No swap, Java order
@@ -308,7 +324,7 @@ public class AjpMessage {
                 (!toContainer && mark != 0x4142)) {
             log.error(sm.getString("ajpmessage.invalid", "" + mark));
             if (log.isDebugEnabled()) {
-                dump("In: ");
+                dump("In");
             }
             return -1;
         }
@@ -319,12 +335,9 @@ public class AjpMessage {
     }
 
 
-    /**
-     * Dump the contents of the message, prefixed with the given String.
-     */
-    public void dump(String msg) {
+    private void dump(String prefix) {
         if (log.isDebugEnabled()) {
-            log.debug(msg + ": " + HexUtils.toHexString(buf) + " " + pos +"/" + (len + 4));
+            log.debug(prefix + ": " + HexUtils.toHexString(buf) + " " + pos +"/" + (len + 4));
         }
         int max = pos;
         if (len + 4 > pos)



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org