Interface PrimitiveArrays.Bytes

Enclosing class:
PrimitiveArrays

public static interface PrimitiveArrays.Bytes
An array of bytes.

Implementations will be thread-safe if the underlying data is not mutated. Users should ensure the underlying data is not mutated in order to get predictable behaviour. Any buffering should be done internally.

Implementations may support arrays > 2GB in size like so:


 new Bytes() {
   byte get(long position) {
     if (position < b1.length) {
       return b1[Ints.checkedCast(position)];
     }
     return b2[Ints.checkedCast(position - b2.length)];
   }
   long length() { return b1.length + b2.length; }
 }