java: allow java to handle array of u16 values [3/11]
@@ -156,6 +156,16 @@ public class SBPMessage {
return ret;
}
+ public int[] getArrayofU16() {
+ return getArrayofU16(buf.remaining());
+ }
+ public int[] getArrayofU16(int n) {
+ int[] ret = new int[n];
+ for (int i = 0; i < n; i++)
+ ret[i] = getU16();
+ return ret;
+ }
+
public float[] getArrayofFloat() {
return getArrayofFloat(buf.remaining());
}
@@ -269,6 +279,15 @@ public class SBPMessage {
putArrayofU8(data);
}
+ public void putArrayofU16(int[] data) {
+ for (int x : data)
+ buf.putShort((short)x);
+ }
+ public void putArrayofU16(int[] data, int n) {
+ assert(n == data.length);
+ putArrayofU16(data);
+ }
+
public void putArrayofDouble(double[] data) {
for (double x: data)
putDouble(x);
