Utils: Add some missing documentation.
@@ -43,6 +43,7 @@ import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterrup
*/
public class Utils {
+ /** Joiner for concatenating words with a space inbetween. */
public static final Joiner SPACE_JOINER = Joiner.on(" ");
private static BlockingQueue<Boolean> mockSleepQueue;
@@ -78,6 +79,7 @@ public class Utils {
return dest;
}
+ /** Write 4 bytes to the byte array (starting at the offset) as unsigned 32-bit integer in big endian format. */
public static void uint32ToByteArrayBE(long val, byte[] out, int offset) {
out[offset] = (byte) (0xFF & (val >> 24));
out[offset + 1] = (byte) (0xFF & (val >> 16));
@@ -85,6 +87,7 @@ public class Utils {
out[offset + 3] = (byte) (0xFF & val);
}
+ /** Write 4 bytes to the byte array (starting at the offset) as unsigned 32-bit integer in little endian format. */
public static void uint32ToByteArrayLE(long val, byte[] out, int offset) {
out[offset] = (byte) (0xFF & val);
out[offset + 1] = (byte) (0xFF & (val >> 8));
@@ -92,6 +95,7 @@ public class Utils {
out[offset + 3] = (byte) (0xFF & (val >> 24));
}
+ /** Write 8 bytes to the byte array (starting at the offset) as signed 64-bit integer in little endian format. */
public static void int64ToByteArrayLE(long val, byte[] out, int offset) {
out[offset] = (byte) (0xFF & val);
out[offset + 1] = (byte) (0xFF & (val >> 8));
@@ -103,6 +107,7 @@ public class Utils {
out[offset + 7] = (byte) (0xFF & (val >> 56));
}
+ /** Write 4 bytes to the output stream as unsigned 32-bit integer in little endian format. */
public static void uint32ToByteStreamLE(long val, OutputStream stream) throws IOException {
stream.write((int) (0xFF & val));
stream.write((int) (0xFF & (val >> 8)));
@@ -110,6 +115,7 @@ public class Utils {
stream.write((int) (0xFF & (val >> 24)));
}
+ /** Write 8 bytes to the output stream as signed 64-bit integer in little endian format. */
public static void int64ToByteStreamLE(long val, OutputStream stream) throws IOException {
stream.write((int) (0xFF & val));
stream.write((int) (0xFF & (val >> 8)));
@@ -121,6 +127,7 @@ public class Utils {
stream.write((int) (0xFF & (val >> 56)));
}
+ /** Write 8 bytes to the output stream as unsigned 64-bit integer in little endian format. */
public static void uint64ToByteStreamLE(BigInteger val, OutputStream stream) throws IOException {
byte[] bytes = val.toByteArray();
if (bytes.length > 8) {
