Created a method in Packet for getting boolean arrays from a ByteBuffer

This commit is contained in:
Mads Boddum
2015-10-04 17:50:42 +02:00
parent 90c55c4120
commit 887a879eb6
+9 -1
View File
@@ -260,7 +260,15 @@ public class Packet {
ints[i] = bb.getInt();
return ints;
}
public static boolean[] getBooleanArray(ByteBuffer bb) {
bb.order(ByteOrder.LITTLE_ENDIAN);
boolean[] booleans = new boolean[bb.getInt()];
for(int i = 0; i < booleans.length; i++)
booleans[i] = getBoolean(bb);
return booleans;
}
/**
* Decodes the ByteBuffer stream into the passed List using the given listType instance for creating elements
* for the list from the buffer.