Package io.karma.sliced.view.impl
Class ArrayByteView
java.lang.Object
io.karma.sliced.view.impl.ArrayByteView
Simple array based implementation of
ByteView
.- Since:
- 03/09/2022
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionasSlice()
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.@NotNull ByteIterator
Creates a newByteIterator
from the elements referenced by this slice instance.boolean
int
hashCode()
int
size()
Retrieves the number of elements contained within the array/collection referenced by this array.byte[]
Creates a newbyte
array with the appropriate size, and copies all values into new newly created array usingSystem.arraycopy(Object, int, Object, int, int)
.@NotNull String
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface io.karma.sliced.view.View
contains, containsAll, containsAllRefs, containsRef, contentEquals, contentEquals, copy, copyArrayList, copyHashSet, forAll, forAllIndexed, forEachIndexed, parallelStream, referencesEqual, referencesEqual, stream, toArray
-
Constructor Details
-
ArrayByteView
public ArrayByteView(byte[] ref)
-
-
Method Details
-
byteIterator
Description copied from interface:ByteView
Creates a newByteIterator
from the elements referenced by this slice instance.- Specified by:
byteIterator
in interfaceByteView
- Returns:
- A new
ByteIterator
from the elements referenced by this slice instance.
-
toByteArray
public byte[] toByteArray()Description copied from interface:ByteView
Creates a newbyte
array with the appropriate size, and copies all values into new newly created array usingSystem.arraycopy(Object, int, Object, int, int)
.- Specified by:
toByteArray
in interfaceByteView
- 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. -
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, seeSlice.of(Object[])
and it's overloads. -
hashCode
public int hashCode() -
equals
-
toString
-