Class ArrayByteView

java.lang.Object
io.karma.sliced.view.impl.ArrayByteView
All Implemented Interfaces:
ByteView, View<Byte>, Iterable<Byte>

@API(status=INTERNAL) public final class ArrayByteView extends Object implements ByteView
Simple array based implementation of ByteView.
Since:
03/09/2022
  • Constructor Details

    • ArrayByteView

      public ArrayByteView(byte[] ref)
  • Method Details

    • byteIterator

      @NotNull public @NotNull ByteIterator byteIterator()
      Description copied from interface: ByteView
      Creates a new ByteIterator from the elements referenced by this slice instance.
      Specified by:
      byteIterator in interface ByteView
      Returns:
      A new ByteIterator from the elements referenced by this slice instance.
    • toByteArray

      public byte[] toByteArray()
      Description copied from interface: ByteView
      Creates a new byte array with the appropriate size, and copies all values into new newly created array using System.arraycopy(Object, int, Object, int, int).
      Specified by:
      toByteArray in interface ByteView
      Returns:
      A new array containing all elements referenced by this slice instance.
    • size

      public int size()
      Description copied from interface: View
      Retrieves the number of elements contained within the array/collection referenced by this array.
      Specified by:
      size in interface View<Byte>
      Returns:
      The number of element contained within the collection/array referenced by this view instance.
    • asSlice

      @NotNull public @NotNull Slice<Byte> asSlice()
      Description copied from interface: View
      Creates a new slice instance from this view instance containing the same underlying collection reference, or a newly created wrapper list if there's no specialization available for the type of the underlying collection. Note If you want to create slices directly, see Slice.of(Object[]) and it's overloads.
      Specified by:
      asSlice in interface View<Byte>
      Returns:
      A new slice instance with a reference to the same collection/array as this view instance.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable @Nullable Object obj)
      Overrides:
      equals in class Object
    • toString

      @NotNull public @NotNull String toString()
      Overrides:
      toString in class Object