Package io.pravega.common.util
Interface CompositeArrayView
-
- All Superinterfaces:
BufferView,StructuredWritableBuffer
- All Known Implementing Classes:
CompositeByteArraySegment
public interface CompositeArrayView extends BufferView, StructuredWritableBuffer
Defines a generic view of a composite, index-based, array-like structure that is made up of one or more individual arrays.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.pravega.common.util.BufferView
BufferView.Collector<ExceptionT extends java.lang.Exception>, BufferView.Reader
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcopyFrom(BufferView.Reader reader, int targetOffset, int length)Copies a specified number of bytes from the givenBufferView.Readerinto thisCompositeArrayView.byteget(int index)Gets the value at the specified index.intgetComponentCount()Gets the number of components in thisCompositeArrayViewinstance.CompositeArrayViewslice(int offset, int length)Creates a newCompositeArrayViewthat represents a sub-range of thisCompositeArrayViewinstance.-
Methods inherited from interface io.pravega.common.util.BufferView
collect, copyTo, copyTo, getBufferViewReader, getCopy, getLength, getReader, getReader, iterateBuffers, release, retain, slice
-
Methods inherited from interface io.pravega.common.util.StructuredWritableBuffer
set, setInt, setLong, setShort, setUnsignedLong
-
-
-
-
Method Detail
-
get
byte get(int index)
Gets the value at the specified index.- Parameters:
index- The index to query.- Returns:
- Byte indicating the value at the given index.
- Throws:
java.lang.ArrayIndexOutOfBoundsException- If index is invalid.
-
copyFrom
void copyFrom(BufferView.Reader reader, int targetOffset, int length)
Copies a specified number of bytes from the givenBufferView.Readerinto thisCompositeArrayView.- Parameters:
reader- TheBufferView.Readerto copy bytes from.targetOffset- The offset within thisCompositeArrayViewto start copying at.length- The number of bytes to copy.- Throws:
java.lang.ArrayIndexOutOfBoundsException- If targetOffset or length are invalid.
-
slice
CompositeArrayView slice(int offset, int length)
Creates a newCompositeArrayViewthat represents a sub-range of thisCompositeArrayViewinstance. The new instance will share the same backing part(s) as this one, so a change to one will be reflected in the other.- Specified by:
slicein interfaceBufferView- Parameters:
offset- The starting offset to begin the slice at.length- The sliced length.- Returns:
- A new
CompositeArrayView.
-
getComponentCount
int getComponentCount()
Gets the number of components in thisCompositeArrayViewinstance.- Returns:
- The number of components. This is the exact number of argument invocations for
BufferView.collect(Collector).
-
-