diff --git a/byteops-unsigned/src/main/java/com/digitalpetri/util/UnsignedByteOps.java b/byteops-unsigned/src/main/java/com/digitalpetri/util/UnsignedByteOps.java index f911a24..9f73cc8 100644 --- a/byteops-unsigned/src/main/java/com/digitalpetri/util/UnsignedByteOps.java +++ b/byteops-unsigned/src/main/java/com/digitalpetri/util/UnsignedByteOps.java @@ -357,36 +357,70 @@ public void setBooleanArray(T bytes, int index, boolean[] values) { delegate.setBooleanArray(bytes, index, values); } + @Override + public void setBooleanArray(T bytes, int index, Boolean[] values) { + delegate.setBooleanArray(bytes, index, values); + } + @Override public void setByteArray(T bytes, int index, byte[] values) { delegate.setByteArray(bytes, index, values); } + @Override + public void setByteArray(T bytes, int index, Byte[] values) { + delegate.setByteArray(bytes, index, values); + } + @Override public void setShortArray(T bytes, int index, short[] values) { delegate.setShortArray(bytes, index, values); } + @Override + public void setShortArray(T bytes, int index, Short[] values) { + delegate.setShortArray(bytes, index, values); + } + @Override public void setIntArray(T bytes, int index, int[] values) { delegate.setIntArray(bytes, index, values); } + @Override + public void setIntArray(T bytes, int index, Integer[] values) { + delegate.setIntArray(bytes, index, values); + } + @Override public void setLongArray(T bytes, int index, long[] values) { delegate.setLongArray(bytes, index, values); } + @Override + public void setLongArray(T bytes, int index, Long[] values) { + delegate.setLongArray(bytes, index, values); + } + @Override public void setFloatArray(T bytes, int index, float[] values) { delegate.setFloatArray(bytes, index, values); } + @Override + public void setFloatArray(T bytes, int index, Float[] values) { + delegate.setFloatArray(bytes, index, values); + } + @Override public void setDoubleArray(T bytes, int index, double[] values) { delegate.setDoubleArray(bytes, index, values); } - // endregion + @Override + public void setDoubleArray(T bytes, int index, Double[] values) { + delegate.setDoubleArray(bytes, index, values); + } + // endregion } diff --git a/byteops/src/main/java/com/digitalpetri/util/AbstractByteOps.java b/byteops/src/main/java/com/digitalpetri/util/AbstractByteOps.java index 3f18499..20e30ee 100644 --- a/byteops/src/main/java/com/digitalpetri/util/AbstractByteOps.java +++ b/byteops/src/main/java/com/digitalpetri/util/AbstractByteOps.java @@ -184,6 +184,13 @@ public void setBooleanArray(T bytes, int index, boolean[] values) { } } + @Override + public void setBooleanArray(T bytes, int index, Boolean[] values) { + for (int i = 0; i < values.length; i++) { + setBoolean(bytes, index + i, values[i]); + } + } + @Override public void setByteArray(T bytes, int index, byte[] values) { for (int i = 0; i < values.length; i++) { @@ -191,6 +198,13 @@ public void setByteArray(T bytes, int index, byte[] values) { } } + @Override + public void setByteArray(T bytes, int index, Byte[] values) { + for (int i = 0; i < values.length; i++) { + setByte(bytes, index + i, values[i]); + } + } + @Override public void setShortArray(T bytes, int index, short[] values) { for (int i = 0; i < values.length; i++) { @@ -198,6 +212,13 @@ public void setShortArray(T bytes, int index, short[] values) { } } + @Override + public void setShortArray(T bytes, int index, Short[] values) { + for (int i = 0; i < values.length; i++) { + setShort(bytes, index + i * 2, values[i]); + } + } + @Override public void setIntArray(T bytes, int index, int[] values) { for (int i = 0; i < values.length; i++) { @@ -205,6 +226,13 @@ public void setIntArray(T bytes, int index, int[] values) { } } + @Override + public void setIntArray(T bytes, int index, Integer[] values) { + for (int i = 0; i < values.length; i++) { + setInt(bytes, index + i * 4, values[i]); + } + } + @Override public void setLongArray(T bytes, int index, long[] values) { for (int i = 0; i < values.length; i++) { @@ -212,6 +240,13 @@ public void setLongArray(T bytes, int index, long[] values) { } } + @Override + public void setLongArray(T bytes, int index, Long[] values) { + for (int i = 0; i < values.length; i++) { + setLong(bytes, index + i * 8, values[i]); + } + } + @Override public void setFloatArray(T bytes, int index, float[] values) { for (int i = 0; i < values.length; i++) { @@ -219,10 +254,24 @@ public void setFloatArray(T bytes, int index, float[] values) { } } + @Override + public void setFloatArray(T bytes, int index, Float[] values) { + for (int i = 0; i < values.length; i++) { + setFloat(bytes, index + i * 4, values[i]); + } + } + @Override public void setDoubleArray(T bytes, int index, double[] values) { for (int i = 0; i < values.length; i++) { setDouble(bytes, index + i * 8, values[i]); } } + + @Override + public void setDoubleArray(T bytes, int index, Double[] values) { + for (int i = 0; i < values.length; i++) { + setDouble(bytes, index + i * 8, values[i]); + } + } } diff --git a/byteops/src/main/java/com/digitalpetri/util/ByteOps.java b/byteops/src/main/java/com/digitalpetri/util/ByteOps.java index f0c85c4..e4bf581 100644 --- a/byteops/src/main/java/com/digitalpetri/util/ByteOps.java +++ b/byteops/src/main/java/com/digitalpetri/util/ByteOps.java @@ -211,6 +211,15 @@ public interface ByteOps { */ void setBooleanArray(T bytes, int index, boolean[] values); + /** + * Set the Boolean array at the given {@code index} in {@code bytes}. + * + * @param bytes the bytes to set the values in. + * @param index the index into {@code bytes} to set the values at. + * @param values the Boolean array to set. + */ + void setBooleanArray(T bytes, int index, Boolean[] values); + /** * Set the byte array at the given {@code index} in {@code bytes}. * @@ -220,6 +229,15 @@ public interface ByteOps { */ void setByteArray(T bytes, int index, byte[] values); + /** + * Set the Byte array at the given {@code index} in {@code bytes}. + * + * @param bytes the bytes to set the values in. + * @param index the index into {@code bytes} to set the values at. + * @param values the Byte array to set. + */ + void setByteArray(T bytes, int index, Byte[] values); + /** * Set the short array at the given {@code index} in {@code bytes}. * @@ -229,6 +247,15 @@ public interface ByteOps { */ void setShortArray(T bytes, int index, short[] values); + /** + * Set the Short array at the given {@code index} in {@code bytes}. + * + * @param bytes the bytes to set the values in. + * @param index the index into {@code bytes} to set the values at. + * @param values the Short array to set. + */ + void setShortArray(T bytes, int index, Short[] values); + /** * Set the int array at the given {@code index} in {@code bytes}. * @@ -238,6 +265,15 @@ public interface ByteOps { */ void setIntArray(T bytes, int index, int[] values); + /** + * Set the Integer array at the given {@code index} in {@code bytes}. + * + * @param bytes the bytes to set the values in. + * @param index the index into {@code bytes} to set the values at. + * @param values the Integer array to set. + */ + void setIntArray(T bytes, int index, Integer[] values); + /** * Set the long array at the given {@code index} in {@code bytes}. * @@ -247,6 +283,15 @@ public interface ByteOps { */ void setLongArray(T bytes, int index, long[] values); + /** + * Set the Long array at the given {@code index} in {@code bytes}. + * + * @param bytes the bytes to set the values in. + * @param index the index into {@code bytes} to set the values at. + * @param values the Long array to set. + */ + void setLongArray(T bytes, int index, Long[] values); + /** * Set the float array at the given {@code index} in {@code bytes}. * @@ -256,6 +301,15 @@ public interface ByteOps { */ void setFloatArray(T bytes, int index, float[] values); + /** + * Set the Float array at the given {@code index} in {@code bytes}. + * + * @param bytes the bytes to set the values in. + * @param index the index into {@code bytes} to set the values at. + * @param values the Float array to set. + */ + void setFloatArray(T bytes, int index, Float[] values); + /** * Set the double array at the given {@code index} in {@code bytes}. * @@ -264,4 +318,13 @@ public interface ByteOps { * @param values the double array to set. */ void setDoubleArray(T bytes, int index, double[] values); + + /** + * Set the Double array at the given {@code index} in {@code bytes}. + * + * @param bytes the bytes to set the values in. + * @param index the index into {@code bytes} to set the values at. + * @param values the Double array to set. + */ + void setDoubleArray(T bytes, int index, Double[] values); }