I am searching for the 8.3 replacement for com.inductiveautomation.xopc.driver.util.ByteUtilities. It is mentioned in the 8.3 programmer's guide but there is no xopc package in the 8.3 api. Has this class been moved somewhere else or is it completely gone?
Everything in the xopc packages was finally made private in 8.3, and it looks like perhaps the one legitimate utility class got caught up in that as well.
Hmmm. Could have used that several years ago.
Yeah, I only put that together somewhat recently. I had also started an effort to migrate the many byte utils in Ignition drivers but it fell apart somewhere.
One thing I'm still bothered about is the boxing problem. I opted for primitive types on the getters in that byteops library, and accepting both in the setters.
But there's a lot of existing code that wants boxed array values created. Lots of tests expecting one or the other. Milo Variant should handle both... but they're not equivalent everywhere you want them to be.
I would do the same, with nulls treated as a "skip" in the setters.
It's not a very satisfying design, which is why I think I didn't do it and then stopped the whole effort, but I should probably just introduce BoxedByteOps interface and then be done with it.
public interface BoxedByteOps<T> extends ByteOps<T> {
/**
* Get the Byte array at the given {@code index} in {@code bytes}.
*
* @param bytes the bytes to get the value from.
* @param index the index into {@code bytes} to get the value at.
* @param length the length of the array.
* @return the Byte array at the given {@code index}.
*/
Byte[] getBoxedByteArray(T bytes, int index, int length);
/**
* 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 setBoxedByteArray(T bytes, int index, Byte[] values);
// etc...
}
That, plus a byteops-milo module similar to the byteops-unsigned but for Milo unsigned types... probably 1.0.
Ewwww!
I'm very much not a fan of arrays of boxed primitives.
If you really need it, consider making Byte[] a supported underlying storage for "bytes". Perhaps with a non-null constraint, so you can keep the primitive getters.
I'm actually just adding a pile of getBoxed* and setBoxed* methods to the main ByteOps interface. Use them, or don't. They're optional, but there if you have code that is already using boxed arrays.
Everything is implied to be non-null right now, but I'm also adding a package-info.java with @NullMarked so static analysis can enforce it. Nullness User Guide | JSpecify
Released version 0.2.1 with much of what was discussed/mention here.