public class TextIntArrayReference extends AbstractReference implements ByteableIntArrayValues
The format of the text representation of an integer array is:
{ capacity: 00000001234, used: 0000000128, values: [ 1234567890, ... ] }
bytes, offset
Constructor and Description |
---|
TextIntArrayReference() |
Modifier and Type | Method and Description |
---|---|
void |
bindValueAt(long index,
net.openhft.chronicle.core.values.IntValue value) |
void |
bytesStore(@NotNull BytesStore bytes,
long offset,
long length)
Sets the underlying BytesStore to work with, along with the offset and length.
|
ByteableIntArrayValues |
capacity(long arrayLength)
Sets the capacity of the array, in terms of the number of integers it can hold.
|
boolean |
compareAndSet(long index,
int expected,
int value) |
long |
getCapacity() |
long |
getUsed() |
int |
getValueAt(long index) |
int |
getVolatileValueAt(long index) |
boolean |
isNull() |
long |
maxSize()
Returns the maximum size in bytes that this reference can point to.
|
static long |
peakLength(@NotNull BytesStore bytes,
long offset)
Determines the length of the array in the text format represented in the given
BytesStore . |
void |
reset() |
void |
setMaxUsed(long usedAtLeast) |
void |
setOrderedValueAt(long index,
int value) |
void |
setValueAt(long index,
int value) |
long |
sizeInBytes(long capacity)
Calculates the size in bytes needed for storing an array with the specified capacity.
|
@NotNull String |
toString()
Returns a String representation of this TextIntArrayReference.
|
static void |
write(@NotNull Bytes<?> bytes,
long capacity)
Writes an array of integers to the specified
Bytes instance in a text format. |
acceptNewBytesStore, address, bytesStore, lock, offset, performClose, tryLock
assertCloseable, assertCloseablesClosed, clearUsedByThread, close, createdHere, disableCloseableTracing, disableThreadSafetyCheck, disableThreadSafetyCheck, enableCloseableTracing, gcAndWaitForCloseablesToClose, isClosed, isClosing, isInUserThread, referenceId, resetUsedByThread, shouldPerformCloseInBackground, shouldWaitForClosed, singleThreadedCheckDisabled, singleThreadedCheckDisabled, singleThreadedCheckReset, threadSafetyCheck, throwExceptionIfClosed, throwExceptionIfClosedInSetter, unmonitor, waitForCloseablesToClose, waitForClosed, warnAndCloseIfNotClosed
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
close, closeQuietly, closeQuietly
public static void write(@NotNull @NotNull Bytes<?> bytes, long capacity) throws IllegalStateException, BufferOverflowException
Bytes
instance in a text format.bytes
- the Bytes instance to write to.capacity
- the capacity of the array to be written.IllegalStateException
- if an invalid state is encountered.BufferOverflowException
- if there's not enough space in the buffer to write the array.public static long peakLength(@NotNull @NotNull BytesStore bytes, long offset) throws IllegalStateException
BytesStore
.bytes
- the BytesStore containing the text representation.offset
- the offset at which the text representation starts.IllegalStateException
- if an invalid state is encountered.public long getUsed() throws IllegalStateException
getUsed
in interface net.openhft.chronicle.core.values.IntArrayValues
IllegalStateException
public void setMaxUsed(long usedAtLeast) throws IllegalStateException
setMaxUsed
in interface net.openhft.chronicle.core.values.IntArrayValues
IllegalStateException
public long getCapacity()
getCapacity
in interface net.openhft.chronicle.core.values.IntArrayValues
public ByteableIntArrayValues capacity(long arrayLength)
ByteableIntArrayValues
capacity
in interface ByteableIntArrayValues
arrayLength
- the desired array capacity, in number of integers.ByteableIntArrayValues
instance.public int getValueAt(long index) throws IllegalStateException
getValueAt
in interface net.openhft.chronicle.core.values.IntArrayValues
IllegalStateException
public void setValueAt(long index, int value) throws IllegalStateException
setValueAt
in interface net.openhft.chronicle.core.values.IntArrayValues
IllegalStateException
public void bindValueAt(long index, net.openhft.chronicle.core.values.IntValue value)
bindValueAt
in interface net.openhft.chronicle.core.values.IntArrayValues
public int getVolatileValueAt(long index) throws IllegalStateException
getVolatileValueAt
in interface net.openhft.chronicle.core.values.IntArrayValues
IllegalStateException
public void setOrderedValueAt(long index, int value) throws IllegalStateException
setOrderedValueAt
in interface net.openhft.chronicle.core.values.IntArrayValues
IllegalStateException
public boolean compareAndSet(long index, int expected, int value) throws IllegalStateException
compareAndSet
in interface net.openhft.chronicle.core.values.IntArrayValues
IllegalStateException
public void bytesStore(@NotNull @NotNull BytesStore bytes, long offset, long length) throws IllegalStateException, IllegalArgumentException, BufferOverflowException
AbstractReference
bytesStore
in interface Byteable
bytesStore
in class AbstractReference
bytes
- the BytesStore to setoffset
- the offset to setlength
- the length to setIllegalStateException
- if the state is invalidIllegalArgumentException
- if the arguments are invalidBufferOverflowException
- if the provided buffer is too smallpublic boolean isNull()
isNull
in interface net.openhft.chronicle.core.values.IntArrayValues
public void reset() throws IllegalStateException
reset
in interface net.openhft.chronicle.core.values.IntArrayValues
IllegalStateException
public long maxSize()
Byteable
@NotNull public @NotNull String toString()
toString
in class net.openhft.chronicle.core.io.AbstractCloseable
public long sizeInBytes(long capacity)
sizeInBytes
in interface ByteableIntArrayValues
sizeInBytes
in interface net.openhft.chronicle.core.values.IntArrayValues
capacity
- The capacity of the array.Copyright © 2023. All rights reserved.