Package io.pravega.common.util
Interface StructuredWritableBuffer
-
- All Superinterfaces:
BufferView
- All Known Subinterfaces:
ArrayView,CompositeArrayView
- All Known Implementing Classes:
ByteArraySegment,CompositeByteArraySegment
public interface StructuredWritableBuffer extends BufferView
ModifiableBufferViewwhose contents can be interpreted as structured data. SeeStructuredReadableBufferfor reading such data.
-
-
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 Default Methods Modifier and Type Method Description voidset(int index, byte value)Sets the value at the specified index.voidsetInt(int index, int value)Sets a 32 bit Integer value at the specified index.voidsetLong(int index, long value)Sets a 64 bit Long value at the specified index.voidsetShort(int index, short value)Sets a Short value at the specified index.default voidsetUnsignedLong(int index, long value)Sets a 64 bit Unsigned Long at the specified index.-
Methods inherited from interface io.pravega.common.util.BufferView
collect, copyTo, copyTo, getBufferViewReader, getCopy, getLength, getReader, getReader, iterateBuffers, release, retain, slice, slice
-
-
-
-
Method Detail
-
set
void set(int index, byte value)Sets the value at the specified index.- Parameters:
index- The index to set the value at.value- The Byte value to set.- Throws:
java.lang.ArrayIndexOutOfBoundsException- If index is invalid.
-
setShort
void setShort(int index, short value)Sets a Short value at the specified index.- Parameters:
index- The index to set the value at.value- The Short value to set.- Throws:
java.lang.ArrayIndexOutOfBoundsException- If index is invalid or if there is insufficient space in the array starting at the specified index to fit the given value.
-
setInt
void setInt(int index, int value)Sets a 32 bit Integer value at the specified index.- Parameters:
index- The index to set the value at.value- The Integer value to set.- Throws:
java.lang.ArrayIndexOutOfBoundsException- If index is invalid or if there is insufficient space in the array starting at the specified index to fit the given value.
-
setLong
void setLong(int index, long value)Sets a 64 bit Long value at the specified index.- Parameters:
index- The index to set the value at.value- The Long value to set.- Throws:
java.lang.ArrayIndexOutOfBoundsException- If index is invalid or if there is insufficient space in the array starting at the specified index to fit the given value.
-
setUnsignedLong
default void setUnsignedLong(int index, long value)Sets a 64 bit Unsigned Long at the specified index. This value can then be deserialized usingStructuredReadableBuffer.getUnsignedLong(int). This method is not interoperable withStructuredReadableBuffer.getLong(int). The advantage of serializing as Unsigned Long (vs. a normal Signed Long) is that the serialization will have the same natural order as the input value type (i.e., if compared using a lexicographic bitwise comparator such as BufferViewComparator, it will have the same ordering as the typical Long type).- Parameters:
index- The index to set the value at.value- The (signed) value to write. The value will be converted into the range [0, 2^64-1] before serialization by flipping the high order bit (so positive values will begin with 1 and negative values will begin with 0).- Throws:
java.lang.ArrayIndexOutOfBoundsException- If index is invalid or if there is insufficient space in the array starting at the specified index to fit the given value.
-
-