android: Also support writing of 24-bit values
authorTobias Brunner <tobias@strongswan.org>
Fri, 26 Apr 2013 12:27:52 +0000 (14:27 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 8 Jul 2013 16:49:27 +0000 (18:49 +0200)
src/frontends/android/src/org/strongswan/android/utils/BufferedByteWriter.java

index 8bb9a82..efc7283 100644 (file)
@@ -135,6 +135,19 @@ public class BufferedByteWriter
        }
 
        /**
+        * Write 24-bit of the given value in big-endian order to the buffer
+        * @param value
+        * @return the writer
+        */
+       public BufferedByteWriter put24(int value)
+       {
+               ensureCapacity(3);
+               mWriter.put((byte)(value >> 16));
+               mWriter.putShort((short)value);
+               return this;
+       }
+
+       /**
         * Write the given int value (32-bit) in big-endian order to the buffer
         * @param value
         * @return the writer