Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
49 changes: 49 additions & 0 deletions byteops/src/main/java/com/digitalpetri/util/AbstractByteOps.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,45 +184,94 @@ 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++) {
setByte(bytes, index + i, values[i]);
}
}

@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++) {
setShort(bytes, index + i * 2, values[i]);
}
}

@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++) {
setInt(bytes, index + i * 4, values[i]);
}
}

@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++) {
setLong(bytes, index + i * 8, values[i]);
}
}

@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++) {
setFloat(bytes, index + i * 4, values[i]);
}
}

@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]);
}
}
}
63 changes: 63 additions & 0 deletions byteops/src/main/java/com/digitalpetri/util/ByteOps.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,15 @@ public interface ByteOps<T> {
*/
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}.
*
Expand All @@ -220,6 +229,15 @@ public interface ByteOps<T> {
*/
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}.
*
Expand All @@ -229,6 +247,15 @@ public interface ByteOps<T> {
*/
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}.
*
Expand All @@ -238,6 +265,15 @@ public interface ByteOps<T> {
*/
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}.
*
Expand All @@ -247,6 +283,15 @@ public interface ByteOps<T> {
*/
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}.
*
Expand All @@ -256,6 +301,15 @@ public interface ByteOps<T> {
*/
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}.
*
Expand All @@ -264,4 +318,13 @@ public interface ByteOps<T> {
* @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);
}