From ef02ca2087aa95fa3d3c22f4429b5d90c0dc0935 Mon Sep 17 00:00:00 2001 From: nathan Date: Sun, 6 Mar 2016 21:30:59 +0100 Subject: [PATCH] Updated documentation --- .../dorkbox/util/bytes/OptimizeUtilsByteArray.java | 7 ++++++- .../src/dorkbox/util/bytes/OptimizeUtilsByteBuf.java | 12 ++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteArray.java b/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteArray.java index 58aa31e..8f6a625 100644 --- a/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteArray.java +++ b/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteArray.java @@ -96,6 +96,10 @@ class OptimizeUtilsByteArray { * FROM KRYO *

* Reads an int from the buffer that was optimized. + * + * @param optimizePositive + * If true, small positive numbers will be more efficient (1 byte) and small negative numbers will be inefficient (5 + * bytes). This ultimately means that it will use fewer bytes for positive numbers. */ @SuppressWarnings("UnusedAssignment") public static @@ -128,7 +132,8 @@ class OptimizeUtilsByteArray { * Writes the specified int to the buffer using 1 to 5 bytes, depending on the size of the number. * * @param optimizePositive - * true if you want to optimize the number of bytes needed to write the length value + * If true, small positive numbers will be more efficient (1 byte) and small negative numbers will be inefficient (5 + * bytes). This ultimately means that it will use fewer bytes for positive numbers. * * @return the number of bytes written. */ diff --git a/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteBuf.java b/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteBuf.java index c093dc3..13a2e4a 100644 --- a/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteBuf.java +++ b/Dorkbox-Util/src/dorkbox/util/bytes/OptimizeUtilsByteBuf.java @@ -47,7 +47,8 @@ class OptimizeUtilsByteBuf { * Returns the number of bytes that would be written with {@link #writeInt(ByteBuf, int, boolean)}. * * @param optimizePositive - * true if you want to optimize the number of bytes needed to write the length value + * If true, small positive numbers will be more efficient (1 byte) and small negative numbers will be inefficient (5 + * bytes). This ultimately means that it will use fewer bytes for positive numbers. */ public static int intLength(int value, boolean optimizePositive) { @@ -97,6 +98,12 @@ class OptimizeUtilsByteBuf { * FROM KRYO *

* Reads an int from the buffer that was optimized. + * + * @param optimizePositive + * If true, small positive numbers will be more efficient (1 byte) and small negative numbers will be inefficient (5 + * bytes). This ultimately means that it will use fewer bytes for positive numbers. + * + * @return the number of bytes written. */ public static int readInt(ByteBuf buffer, boolean optimizePositive) { @@ -127,7 +134,8 @@ class OptimizeUtilsByteBuf { * Writes the specified int to the buffer using 1 to 5 bytes, depending on the size of the number. * * @param optimizePositive - * true if you want to optimize the number of bytes needed to write the length value + * If true, small positive numbers will be more efficient (1 byte) and small negative numbers will be inefficient (5 + * bytes). This ultimately means that it will use fewer bytes for positive numbers. * * @return the number of bytes written. */