U
- Underlying typepublic abstract class AbstractBytes<U> extends net.openhft.chronicle.core.io.AbstractReferenceCounted implements Bytes<U>, HasUncheckedRandomDataInput, DecimalAppender
Modifier and Type | Field and Description |
---|---|
protected @NotNull BytesStore<Bytes<U>,U> |
bytesStore |
protected static boolean |
DISABLE_THREAD_SAFETY
Deprecated.
|
protected boolean |
isPresent |
protected long |
readPosition |
protected long |
writeLimit |
referenceCounted, WARN_COUNT, WARN_NS
DEFAULT_BYTE_BUFFER_CAPACITY, MAX_CAPACITY, MAX_HEAP_CAPACITY
charToString
JAVA9_STRING_CODER_LATIN, JAVA9_STRING_CODER_UTF16
Modifier and Type | Method and Description |
---|---|
@NotNull UncheckedRandomDataInput |
acquireUncheckedInput()
Returns a view of a memory segment providing memory read operations with potentially unchecked
memory boundaries.
|
long |
addressForRead(long offset)
Obtain the underlying addressForRead.
|
long |
addressForWrite(long offset)
Obtain the underlying addressForRead.
|
long |
addressForWritePosition() |
void |
append(boolean negative,
long mantissa,
int exponent)
Appends a numeric value in decimal form with the specified mantissa and exponent,
handling negative values and decimal point placement.
|
@NotNull AbstractBytes<U> |
append(double d)
Appends the string representation of the given double value to the bytes.
|
@NotNull Bytes<U> |
append(double d,
int decimalPlaces)
Appends a double in decimal notation to a specific number of decimal places.
|
@NotNull Bytes<U> |
append(float f)
Appends the string representation of the given float value to the bytes.
|
@NotNull Bytes<U> |
append(int value)
Appends an int in decimal to this.
|
@NotNull Bytes<U> |
append(long value)
Appends a long value in decimal.
|
long |
appendAndReturnLength(long writePosition,
boolean negative,
long mantissa,
int exponent,
boolean append0) |
int |
byteCheckSum()
Returns the bytes sum of the readable bytes in this BytesStore.
|
int |
byteCheckSum(int start,
int end) |
int |
byteCheckSum(long start,
long end)
Returns the bytes sum between the specified indexes; start (inclusive) and end (exclusive).
|
@NotNull BytesStore |
bytesStore()
Returns the backing ByteStore this Bytes object wraps, or null.
|
protected void |
bytesStore(BytesStore<Bytes<U>,U> bytesStore) |
boolean |
canReadDirect(long length) |
boolean |
canWriteDirect(long count) |
long |
capacity() |
@NotNull Bytes<U> |
clear()
Set the readPosition= writePosition = start, writeLimit = capacity
|
@NotNull Bytes<U> |
clearAndPad(long length)
Clear a buffer, with a given padding to allow for prepending later.
|
@NotNull Bytes<U> |
compact()
Compact these Bytes by moving the readPosition to the start.
|
boolean |
compareAndSwapInt(long offset,
int expected,
int value)
Perform a 32-bit CAS at a given offset.
|
boolean |
compareAndSwapLong(long offset,
long expected,
long value)
Perform a 64-bit CAS at a given offset.
|
BytesStore<Bytes<U>,U> |
copy()
Creates and returns a new copy of this Bytes object from
RandomCommon.readPosition()
to RandomCommon.readLimit() . |
int |
copyTo(byte[] bytes)
Read a byte[] from memory from
RandomCommon.readPosition()
to RandomCommon.readLimit() . |
Decimaliser |
decimaliser()
Gets the Decimaliser currently associated with this ByteStringAppender.
|
Bytes<U> |
decimaliser(Decimaliser decimaliser)
Associates a Decimaliser with this ByteStringAppender.
|
boolean |
equals(Object obj) |
boolean |
fpAppend0() |
Bytes<U> |
fpAppend0(boolean append0) |
int |
hashCode() |
byte[] |
internalNumberBuffer()
Deprecated.
|
boolean |
isDirectMemory() |
boolean |
isElastic()
Returns if this Bytes object is elastic.
|
boolean |
isImmutableEmptyByteStore()
Returns if this ByteStore is an immutable empty ByteStore or if it is backed
by an immutable empty ByteStore.
|
int |
lastDecimalPlaces() |
void |
lastDecimalPlaces(int lastDecimalPlaces)
Store the last number of decimal places.
|
boolean |
lastNumberHadDigits() |
void |
lastNumberHadDigits(boolean lastNumberHadDigits) |
int |
length()
This method is inherited from CharSequence so result should be the length of the contained
chars sequence although it actually returns the number of underlying bytes.
|
boolean |
lenient() |
void |
lenient(boolean lenient)
When there is no more data to read, return zero,
false and empty string. |
void |
move(long from,
long to,
long length) |
void |
nativeRead(long position,
long address,
long size)
expert level method for copying data to native memory.
|
void |
nativeWrite(long address,
long position,
long size)
expert level method to copy data from native memory into the BytesStore
|
int |
peekUnsignedByte() |
int |
peekUnsignedByte(long offset)
Read an unsigned byte at an offset, or -1
|
protected void |
performRelease() |
@NotNull Bytes<U> |
prewrite(byte[] bytes)
Write backward in binary a byte
|
@NotNull Bytes<U> |
prewrite(@NotNull BytesStore bytes)
Write backward in binary a byte
|
@NotNull Bytes<U> |
prewriteByte(byte i8)
Write backward in binary a byte
|
@NotNull Bytes<U> |
prewriteInt(int i)
Write backward in binary a 4 byte int
|
@NotNull Bytes<U> |
prewriteLong(long l)
Write backward in binary an 8 byte long
|
protected long |
prewriteOffsetPositionMoved(long subtracting) |
@NotNull Bytes<U> |
prewriteShort(short i)
Write backward in binary a 2 byte int
|
int |
read(byte[] bytes,
int off,
int len) |
long |
read(long offsetInRDI,
byte[] bytes,
int offset,
int length) |
byte |
readByte() |
byte |
readByte(long offset)
Read byte at an offset
|
protected void |
readCheckOffset(long offset,
long adding,
boolean given) |
double |
readDouble() |
double |
readDouble(long offset)
Read a double at an offset
|
float |
readFloat() |
float |
readFloat(long offset)
Read a float at an offset
|
int |
readInt() |
int |
readInt(long offset)
Read an int at an offset
|
long |
readLimit()
If the resource is closed, the returned value is unspecified.
|
@NotNull Bytes<U> |
readLimit(long limit) |
long |
readLong() |
long |
readLong(long offset)
Read a long at an offset
|
protected long |
readOffsetPositionMoved(long adding) |
long |
readPosition()
Returns the read position.
|
@NotNull Bytes<U> |
readPosition(long position) |
long |
readPositionForHeader(boolean skipPadding)
obtain the readPosition skipping any padding needed for a header.
|
short |
readShort() |
short |
readShort(long offset)
Read a short at an offset
|
@NotNull Bytes<U> |
readSkip(long bytesToSkip)
Skip a number of bytes by moving the readPosition.
|
int |
readUnsignedByte() |
int |
readUnsignedByte(long offset)
Read an unsigned byte at an offset
|
byte |
readVolatileByte(long offset)
Read a 8-bit byte from memory with a load barrier.
|
int |
readVolatileInt() |
int |
readVolatileInt(long offset)
Read a 32-bit int from memory with a load barrier.
|
long |
readVolatileLong() |
long |
readVolatileLong(long offset)
Read a 64-bit long from memory with a load barrier.
|
short |
readVolatileShort(long offset)
Read a 16-bit short from memory with a load barrier.
|
long |
realCapacity()
Returns the actual capacity that can be potentially read.
|
protected int |
safeCopySize() |
long |
start() |
boolean |
startsWith(@Nullable BytesStore bytesStore)
Returns if the content of this BytesStore starts with bytes equal to the content of a specified BytesStore.
|
void |
testAndSetInt(long offset,
int expected,
int value) |
@NotNull String |
toString() |
void |
uncheckedReadSkipBackOne()
Read skip -1 when you are sure this is safe.
|
void |
uncheckedReadSkipOne()
Read skip 1 when you are sure this is safe.
|
int |
uncheckedReadUnsignedByte() |
protected void |
uncheckedWritePosition(long writePosition) |
U |
underlyingObject() |
@NotNull Bytes<U> |
write(byte[] byteArray,
int offset,
int length)
Writes all data from the provided
byteArray into this Bytes object. |
Bytes<U> |
write(@NotNull BytesStore<?,?> bytes)
Writes all the passed BytesStore or it fails.
|
@NotNull Bytes<U> |
write(long offsetInRDO,
byte[] byteArray,
int offset,
int length)
Copies the provided
byteArray to this Bytes object starting at writeOffset taking
content starting at readOffset but copying at most length bytes. |
void |
write(long offsetInRDO,
@NotNull ByteBuffer bytes,
int offset,
int length)
Copy from ByteBuffer into this.
|
@NotNull Bytes<U> |
write(long writeOffset,
@NotNull RandomDataInput bytes,
long readOffset,
long length)
Copy from RandomDataInput into this.
|
@NotNull Bytes<U> |
write(@NotNull RandomDataInput bytes)
Write all data or fail.
|
@NotNull Bytes<U> |
write8bit(@Nullable BytesStore bs) |
long |
write8bit(long position,
@NotNull BytesStore bs)
Write the stop bit length and copy the BytesStore
|
long |
write8bit(long position,
@NotNull String s,
int start,
int length) |
@NotNull Bytes<U> |
write8bit(@NotNull String text,
int start,
int length) |
@NotNull Bytes<U> |
writeBoolean(boolean flag) |
@NotNull Bytes<U> |
writeByte(byte i8) |
@NotNull Bytes<U> |
writeByte(long offset,
byte i)
Write an unsigned byte at an offset.
|
protected void |
writeCheckOffset(long offset,
long adding) |
@NotNull Bytes<U> |
writeDouble(double d) |
@NotNull Bytes<U> |
writeDouble(long offset,
double d)
Write a double at an offset.
|
@NotNull Bytes<U> |
writeDoubleAndInt(double d,
int i) |
@NotNull Bytes<U> |
writeFloat(float f) |
@NotNull Bytes<U> |
writeFloat(long offset,
float d)
Write a float at an offset.
|
@NotNull Bytes<U> |
writeInt(int i) |
@NotNull Bytes<U> |
writeInt(long offset,
int i)
Write an int at an offset.
|
@NotNull Bytes<U> |
writeIntAdv(int i,
int advance) |
long |
writeLimit()
Returns the write limit.
|
@NotNull Bytes<U> |
writeLimit(long limit) |
@NotNull Bytes<U> |
writeLong(long i64)
Write a long
|
@NotNull Bytes<U> |
writeLong(long offset,
long i)
Write a long at an offset.
|
@NotNull Bytes<U> |
writeLongAdv(long i64,
int advance) |
protected long |
writeOffsetPositionMoved(long adding) |
protected long |
writeOffsetPositionMoved(long adding,
long advance) |
@NotNull Bytes<U> |
writeOrderedInt(int i) |
@NotNull Bytes<U> |
writeOrderedInt(long offset,
int i)
Perform a non stalling write with a store barrier.
|
@NotNull Bytes<U> |
writeOrderedLong(long i) |
@NotNull Bytes<U> |
writeOrderedLong(long offset,
long i)
Perform a non stalling write with a store barrier.
|
long |
writePosition()
Returns the write position.
|
@NotNull Bytes<U> |
writePosition(long position) |
@NotNull Bytes<U> |
writeShort(long offset,
short i)
Write a short at an offset.
|
@NotNull Bytes<U> |
writeShort(short i16) |
@NotNull Bytes<U> |
writeSkip(long bytesToSkip)
Skip a number of bytes by moving the writePosition.
|
@NotNull Bytes<U> |
writeSome(@NotNull ByteBuffer buffer)
Write all data available from buffer, constrained by how much space available in this.
|
@NotNull Bytes<U> |
writeVolatileByte(long offset,
byte i8) |
@NotNull Bytes<U> |
writeVolatileInt(long offset,
int i32) |
@NotNull Bytes<U> |
writeVolatileLong(long offset,
long i64) |
@NotNull Bytes<U> |
writeVolatileShort(long offset,
short i16) |
addReferenceChangeListener, assertReferencesReleased, backgroundPerformRelease, canReleaseInBackground, clearUsedByThread, createdHere, disableReferenceTracing, enableReferenceTracing, refCount, referenceCountedUnmonitored, referenceId, release, releaseLast, removeReferenceChangeListener, reserve, reservedBy, reserveTransfer, singleThreadedCheckDisabled, singleThreadedCheckReset, threadSafetyCheck, throwExceptionIfNotReleased, throwExceptionIfReleased, tryReserve, unmonitor, warnAndReleaseIfNotReleased
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
allocateDirect, allocateDirect, allocateElasticDirect, allocateElasticDirect, allocateElasticOnHeap, allocateElasticOnHeap, bytesForRead, bytesForWrite, copyTo, copyTo, directFrom, elasticByteBuffer, elasticByteBuffer, elasticByteBuffer, elasticHeapByteBuffer, elasticHeapByteBuffer, empty, ensureCapacity, forFieldGroup, from, from, fromDirect, fromHexString, indexOf, indexOf, isClear, isEqual, readMarshallableLength16, readWithLength, readWrite, safeLimit, sharedMemory, toHexString, toHexString, toHexString, toString, toString, toString, unchecked, unchecked, unwrite, valueOf, wrapForRead, wrapForRead, wrapForWrite, wrapForWrite, write, writeMarshallableLength16
addAndGetDouble, addAndGetDoubleNotAtomic, addAndGetFloat, addAndGetFloatNotAtomic, addAndGetInt, addAndGetIntNotAtomic, addAndGetLong, addAndGetShortNotAtomic, addAndGetUnsignedByteNotAtomic, charAt, cipher, cipher, compareAndSwapDouble, compareAndSwapFloat, contentEquals, elasticByteBuffer, endsWith, equalBytes, follow, forFields, from, hash, inside, inside, isEmpty, isEqual, lazyNativeBytesStoreWithFixedCapacity, nativePointer, nativeStore, nativeStoreFrom, nativeStoreWithFixedCapacity, startsWith, subSequence, to8bitString, toDebugString, toDebugString, wrap, wrap, wrap, writeMaxInt, writeMaxLong, zeroOut
append, append, write, write, writeBoolean, writeByte, writeInt24, writeOrderedDouble, writeOrderedFloat, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUtf8, writeUtf8Limited, writeVolatileDouble, writeVolatileFloat
chars, codePoints
bytesMethodReader, bytesMethodReaderBuilder, readObject
canReadDirect, compareUtf8, copyTo, createCharToString, fastHash, findByte, parseLong, peekVolatileInt, printable, readBoolean, readIncompleteLong, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8Limited, readUtf8Limited, readVolatileDouble, readVolatileFloat, subBytes, toByteArray, toTemporaryDirectByteBuffer
parse8bit, parse8bit, parse8bit, parse8bit, parse8bit, parseBigDecimal, parseBoolean, parseBoolean, parseDouble, parseFlexibleLong, parseFloat, parseInt, parseLong, parseLongDecimal, parseUtf8, parseUtf8, parseUtf8, reader, skipTo
inputStream, parseHexLong, parseUtf8, parseUtf8, rawReadByte, rawReadInt, rawReadLong, read, read, read, read, read, read8bit, read8bit, read8bit, readBigDecimal, readBigInteger, readBoolean, readChar, readEnum, readHistogram, readIncompleteLong, readInt24, readLimitToCapacity, readPositionRemaining, readPositionUnlimited, readStopBit, readStopBitChar, readStopBitDecimal, readStopBitDouble, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8, readUtf8, readUtf8, readWithLength, readWithLength, readWithLength0, unsafeRead, unsafeReadObject, unsafeReadObject
bytesMethodWriter, writeObject
append, append, append, append, append, append8bit, append8bit, append8bit, append8bit, append8bit, appendBase, appendBase16, appendBase16, appendDateMillis, appendDecimal, appendTimeMillis, writer
appendUtf8, appendUtf8, appendUtf8, appendUtf8, appendUtf8, appendUtf8, copyFrom, outputStream, rawWriteByte, rawWriteInt, rawWriteLong, unsafeWrite, unsafeWriteObject, unsafeWriteObject, write, write, write, write, write, write8bit, write8bit, write8bit, writeBigDecimal, writeBigInteger, writeChar, writeEnum, writeHistogram, writeInt24, writePositionForHeader, writePositionRemaining, writeSome, writeStopBit, writeStopBit, writeStopBit, writeStopBitDecimal, writeUnsignedByte, writeUnsignedInt, writeUnsignedInt24, writeUnsignedShort, writeUtf8, writeUtf8, writeWithLength
prepend
adjustHexDumpIndentation, retainedHexDumpDescription, writeHexDumpDescription
@Deprecated protected static final boolean DISABLE_THREAD_SAFETY
@NotNull protected @NotNull BytesStore<Bytes<U>,U> bytesStore
protected long readPosition
protected long writeLimit
protected boolean isPresent
public boolean isDirectMemory()
isDirectMemory
in interface BytesStore<Bytes<U>,U>
public boolean canReadDirect(long length)
canReadDirect
in interface RandomDataInput
public void move(long from, long to, long length) throws BufferUnderflowException, IllegalStateException, ArithmeticException
move
in interface BytesStore<Bytes<U>,U>
BufferUnderflowException
IllegalStateException
ArithmeticException
@NotNull public @NotNull Bytes<U> compact() throws IllegalStateException
Bytes
compact
in interface Bytes<U>
IllegalStateException
- if this Bytes object has been previously released@NotNull public @NotNull Bytes<U> clear() throws IllegalStateException
StreamingCommon
clear
in interface Bytes<U>
clear
in interface StreamingCommon<Bytes<U>>
IllegalStateException
- if this resource has been previously released@NotNull public @NotNull Bytes<U> clearAndPad(long length) throws BufferOverflowException
BytesPrepender
clearAndPad
in interface BytesPrepender<Bytes<U>>
length
- to padBufferOverflowException
- if the length > capacity() - start()public long readLimit()
If the resource is closed, the returned value is unspecified.
public long writeLimit()
If the resource is closed, the returned value is unspecified.
public long realCapacity()
RandomDataInput
realCapacity
in interface Bytes<U>
realCapacity
in interface BytesStore<Bytes<U>,U>
realCapacity
in interface RandomDataInput
realCapacity
in interface StreamingDataOutput<Bytes<U>>
public boolean canWriteDirect(long count)
canWriteDirect
in interface StreamingDataOutput<Bytes<U>>
public long capacity()
capacity
in interface BytesStore<Bytes<U>,U>
@Nullable public U underlyingObject()
underlyingObject
in interface BytesStore<Bytes<U>,U>
public int length()
BytesStore
length
in interface CharSequence
length
in interface BytesStore<Bytes<U>,U>
public long start()
public long readPosition()
The read position is start() <= readPosition() && readPosition() <= readLimit() && readPosition < safeLimit()
If the resource is closed, the returned value is unspecified.
public long writePosition()
The write position is readPosition() <= writePosition() && writePosition() <= writeLimit()
If the resource is closed, the returned value is unspecified.
public boolean compareAndSwapInt(long offset, int expected, int value) throws BufferOverflowException, IllegalStateException
RandomDataInput
compareAndSwapInt
in interface BytesStore<Bytes<U>,U>
compareAndSwapInt
in interface RandomDataInput
compareAndSwapInt
in interface RandomDataOutput<Bytes<U>>
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalStateException
public void testAndSetInt(long offset, int expected, int value) throws BufferOverflowException, IllegalStateException
testAndSetInt
in interface RandomDataInput
testAndSetInt
in interface RandomDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
public boolean compareAndSwapLong(long offset, long expected, long value) throws BufferOverflowException, IllegalStateException
RandomDataInput
compareAndSwapLong
in interface BytesStore<Bytes<U>,U>
compareAndSwapLong
in interface RandomDataInput
compareAndSwapLong
in interface RandomDataOutput<Bytes<U>>
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalStateException
@NotNull public @NotNull AbstractBytes<U> append(double d) throws BufferOverflowException, IllegalStateException
append
in interface ByteStringAppender<Bytes<U>>
d
- the double value to append.BufferOverflowException
- if there is not enough space to write the double.IllegalStateException
- if this buffer is closed.@NotNull public @NotNull Bytes<U> append(float f) throws BufferOverflowException, IllegalStateException
append
in interface ByteStringAppender<Bytes<U>>
f
- the float value to append.BufferOverflowException
- if there is not enough space to write the float.IllegalStateException
- if this buffer is closed.@NotNull public @NotNull Bytes<U> append(int value) throws BufferOverflowException, IllegalArgumentException, IllegalStateException
ByteStringAppender
append
in interface ByteStringAppender<Bytes<U>>
value
- the integer value to appendBufferOverflowException
- if the relative append operation exceeds the underlying buffer's capacityIllegalArgumentException
IllegalStateException
@NotNull public @NotNull Bytes<U> append(long value) throws BufferOverflowException, IllegalStateException
ByteStringAppender
append
in interface ByteStringAppender<Bytes<U>>
value
- the long number to appendBufferOverflowException
- if the relative append operation exceeds the underlying buffer's capacityIllegalStateException
public Decimaliser decimaliser()
ByteStringAppender
decimaliser
in interface ByteStringAppender<Bytes<U>>
public Bytes<U> decimaliser(Decimaliser decimaliser)
ByteStringAppender
The Decimaliser is an interface which can be implemented to provide custom logic for rendering decimal numbers in this ByteStringAppender.
decimaliser
in interface ByteStringAppender<Bytes<U>>
decimaliser
- The Decimaliser to be associated with this ByteStringAppender.public boolean fpAppend0()
fpAppend0
in interface ByteStringAppender<Bytes<U>>
public Bytes<U> fpAppend0(boolean append0)
fpAppend0
in interface ByteStringAppender<Bytes<U>>
append0
- Does floating point add .0 to indicate it is a floating point even if redundant.public void append(boolean negative, long mantissa, int exponent)
append
in interface DecimalAppender
negative
- indicates if the number is negative.mantissa
- the mantissa of the number to append.exponent
- the exponent indicating the position of the decimal point.public long appendAndReturnLength(long writePosition, boolean negative, long mantissa, int exponent, boolean append0)
appendAndReturnLength
in interface RandomDataOutput<Bytes<U>>
@NotNull public @NotNull Bytes<U> append(double d, int decimalPlaces) throws BufferOverflowException, IllegalArgumentException, IllegalStateException, ArithmeticException
ByteStringAppender
If the number would normally be printed with more decimal places, the number is rounded.
append
in interface ByteStringAppender<Bytes<U>>
d
- to appenddecimalPlaces
- to always produceBufferOverflowException
IllegalArgumentException
IllegalStateException
ArithmeticException
@NotNull public @NotNull Bytes<U> readPosition(long position) throws BufferUnderflowException, IllegalStateException
readPosition
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> readLimit(long limit) throws BufferUnderflowException
readLimit
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
@NotNull public @NotNull Bytes<U> writePosition(long position) throws BufferOverflowException
writePosition
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
@NotNull public @NotNull Bytes<U> readSkip(long bytesToSkip) throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readSkip
in interface StreamingDataInput<Bytes<U>>
bytesToSkip
- bytes to skip.BufferUnderflowException
- if the offset is outside the limits of the BytesIllegalStateException
public long readPositionForHeader(boolean skipPadding)
StreamingDataInput
readPositionForHeader
in interface StreamingDataInput<Bytes<U>>
skipPadding
- optional aligning to 4 bytespublic void uncheckedReadSkipOne()
StreamingDataInput
uncheckedReadSkipOne
in interface StreamingDataInput<Bytes<U>>
public void uncheckedReadSkipBackOne()
StreamingDataInput
uncheckedReadSkipBackOne
in interface StreamingDataInput<Bytes<U>>
@NotNull public @NotNull Bytes<U> writeSkip(long bytesToSkip) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeSkip
in interface StreamingDataOutput<Bytes<U>>
bytesToSkip
- bytes to skip. This can be negative.BufferOverflowException
- if the offset is outside the limits of the BytesIllegalStateException
@NotNull public @NotNull Bytes<U> writeLimit(long limit) throws BufferOverflowException
writeLimit
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
protected void performRelease()
performRelease
in class net.openhft.chronicle.core.io.AbstractReferenceCounted
public int readUnsignedByte() throws IllegalStateException
readUnsignedByte
in interface StreamingDataInput<Bytes<U>>
IllegalStateException
public int readUnsignedByte(long offset) throws BufferUnderflowException, IllegalStateException
RandomDataInput
readUnsignedByte
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the BytesIllegalStateException
- if releasedpublic int uncheckedReadUnsignedByte()
uncheckedReadUnsignedByte
in interface StreamingDataInput<Bytes<U>>
public byte readByte() throws IllegalStateException
readByte
in interface StreamingDataInput<Bytes<U>>
IllegalStateException
public int peekUnsignedByte() throws IllegalStateException
peekUnsignedByte
in interface StreamingDataInput<Bytes<U>>
IllegalStateException
public short readShort() throws BufferUnderflowException, IllegalStateException
readShort
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
IllegalStateException
public int readInt() throws BufferUnderflowException, IllegalStateException
readInt
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
IllegalStateException
public byte readVolatileByte(long offset) throws BufferUnderflowException, IllegalStateException
RandomDataInput
readVolatileByte
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the BytesIllegalStateException
- if releasedpublic short readVolatileShort(long offset) throws BufferUnderflowException, IllegalStateException
RandomDataInput
readVolatileShort
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the BytesIllegalStateException
- if releasedpublic int readVolatileInt(long offset) throws BufferUnderflowException, IllegalStateException
RandomDataInput
readVolatileInt
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the BytesIllegalStateException
- if releasedpublic long readVolatileLong(long offset) throws BufferUnderflowException, IllegalStateException
RandomDataInput
readVolatileLong
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the BytesIllegalStateException
- if releasedpublic long readLong() throws BufferUnderflowException, IllegalStateException
readLong
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
IllegalStateException
public float readFloat() throws BufferUnderflowException, IllegalStateException
readFloat
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
IllegalStateException
public double readDouble() throws BufferUnderflowException, IllegalStateException
readDouble
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
IllegalStateException
public int readVolatileInt() throws BufferUnderflowException, IllegalStateException
readVolatileInt
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
IllegalStateException
public long readVolatileLong() throws BufferUnderflowException, IllegalStateException
readVolatileLong
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
IllegalStateException
protected long readOffsetPositionMoved(long adding) throws BufferUnderflowException, IllegalStateException
@NotNull public @NotNull Bytes<U> writeByte(long offset, byte i) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeByte
in interface RandomDataOutput<Bytes<U>>
offset
- to write toi
- the valueBufferOverflowException
- if the capacity was exceededIllegalStateException
@NotNull public @NotNull Bytes<U> writeShort(long offset, short i) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeShort
in interface RandomDataOutput<Bytes<U>>
offset
- to write toi
- the valueBufferOverflowException
- if the capacity was exceededIllegalStateException
@NotNull public @NotNull Bytes<U> writeInt(long offset, int i) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeInt
in interface RandomDataOutput<Bytes<U>>
offset
- to write toi
- the valueBufferOverflowException
- if the capacity was exceededIllegalStateException
@NotNull public @NotNull Bytes<U> writeOrderedInt(long offset, int i) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeOrderedInt
in interface RandomDataOutput<Bytes<U>>
offset
- to write toi
- value to writeBufferOverflowException
- if the capacity was exceededIllegalStateException
@NotNull public @NotNull Bytes<U> writeLong(long offset, long i) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeLong
in interface RandomDataOutput<Bytes<U>>
offset
- to write toi
- the valueBufferOverflowException
- if the capacity was exceededIllegalStateException
@NotNull public @NotNull Bytes<U> writeOrderedLong(long offset, long i) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeOrderedLong
in interface RandomDataOutput<Bytes<U>>
offset
- to write toi
- value to writeBufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> writeFloat(long offset, float d) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeFloat
in interface RandomDataOutput<Bytes<U>>
offset
- to write tod
- the valueBufferOverflowException
- if the capacity was exceededIllegalStateException
@NotNull public @NotNull Bytes<U> writeDouble(long offset, double d) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeDouble
in interface RandomDataOutput<Bytes<U>>
offset
- to write tod
- the valueBufferOverflowException
- if the capacity was exceededIllegalStateException
@NotNull public @NotNull Bytes<U> writeVolatileByte(long offset, byte i8) throws BufferOverflowException, IllegalStateException
writeVolatileByte
in interface RandomDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> writeVolatileShort(long offset, short i16) throws BufferOverflowException, IllegalStateException
writeVolatileShort
in interface RandomDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> writeVolatileInt(long offset, int i32) throws BufferOverflowException, IllegalStateException
writeVolatileInt
in interface RandomDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> writeVolatileLong(long offset, long i64) throws BufferOverflowException, IllegalStateException
writeVolatileLong
in interface RandomDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> write(@NotNull @NotNull RandomDataInput bytes) throws IllegalStateException, BufferOverflowException
StreamingDataOutput
Calling this method will update the cursors of this, but not the bytes we read from.
write
in interface StreamingDataOutput<Bytes<U>>
IllegalStateException
BufferOverflowException
public Bytes<U> write(@NotNull @NotNull BytesStore<?,?> bytes) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
Calling this method will update the cursors of this, but not the bytes we read from.
write
in interface StreamingDataOutput<Bytes<U>>
bytes
- to writeBufferOverflowException
IllegalStateException
StreamingDataInput.read(Bytes)
@NotNull public @NotNull Bytes<U> write(long offsetInRDO, byte[] byteArray, int offset, int length) throws BufferOverflowException, IllegalStateException
RandomDataOutput
byteArray
to this Bytes object starting at writeOffset
taking
content starting at readOffset
but copying at most length
bytes.
Does not update cursors e.g. writePosition()
write
in interface RandomDataOutput<Bytes<U>>
offsetInRDO
- non-negative offset to write tobyteArray
- non-null copy from byteArrayoffset
- non-negative copy from offsetlength
- non-negative length to copyBufferOverflowException
- if this Bytes object cannot accommodate all the bytes to copy.IllegalStateException
- if this Bytes object has been previously releasedpublic void write(long offsetInRDO, @NotNull @NotNull ByteBuffer bytes, int offset, int length) throws BufferOverflowException, IllegalStateException
RandomDataOutput
Does not update cursors e.g. writePosition()
write
in interface RandomDataOutput<Bytes<U>>
offsetInRDO
- offset to write tobytes
- copy from bytesoffset
- copy from offsetBufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> write(long writeOffset, @NotNull @NotNull RandomDataInput bytes, long readOffset, long length) throws BufferOverflowException, BufferUnderflowException, IllegalStateException
RandomDataOutput
writePosition()
nor RandomCommon.readPosition()
write
in interface RandomDataOutput<Bytes<U>>
writeOffset
- offset to write tobytes
- copy from bytesreadOffset
- copy from offsetBufferOverflowException
IllegalStateException
BufferUnderflowException
@NotNull public @NotNull Bytes<U> write8bit(@NotNull @NotNull String text, int start, int length) throws BufferOverflowException, IndexOutOfBoundsException, ArithmeticException, IllegalStateException, BufferUnderflowException
write8bit
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
IndexOutOfBoundsException
ArithmeticException
IllegalStateException
BufferUnderflowException
@NotNull public @NotNull Bytes<U> write8bit(@Nullable @Nullable BytesStore bs) throws BufferOverflowException, IllegalStateException, BufferUnderflowException
public long write8bit(long position, @NotNull @NotNull BytesStore bs)
RandomDataOutput
write8bit
in interface RandomDataOutput<Bytes<U>>
position
- to writebs
- to copy.RandomDataOutput
public long write8bit(long position, @NotNull @NotNull String s, int start, int length)
write8bit
in interface RandomDataOutput<Bytes<U>>
protected void writeCheckOffset(long offset, long adding) throws BufferOverflowException, IllegalStateException
public byte readByte(long offset) throws BufferUnderflowException, IllegalStateException
RandomDataInput
readByte
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the BytesIllegalStateException
- if releasedpublic int peekUnsignedByte(long offset) throws IllegalStateException
RandomDataInput
peekUnsignedByte
in interface RandomDataInput
offset
- to readIllegalStateException
- if releasedpublic short readShort(long offset) throws BufferUnderflowException, IllegalStateException
RandomDataInput
readShort
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the BytesIllegalStateException
- if releasedpublic int readInt(long offset) throws BufferUnderflowException, IllegalStateException
RandomDataInput
readInt
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the BytesIllegalStateException
- if releasedpublic long readLong(long offset) throws BufferUnderflowException, IllegalStateException
RandomDataInput
readLong
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the BytesIllegalStateException
- if releasedpublic float readFloat(long offset) throws BufferUnderflowException, IllegalStateException
RandomDataInput
readFloat
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the BytesIllegalStateException
- if releasedpublic double readDouble(long offset) throws BufferUnderflowException, IllegalStateException
RandomDataInput
readDouble
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the BytesIllegalStateException
- if releasedprotected void readCheckOffset(long offset, long adding, boolean given) throws BufferUnderflowException, IllegalStateException
@NotNull public @NotNull Bytes<U> writeByte(byte i8) throws BufferOverflowException, IllegalStateException
writeByte
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> prewrite(byte[] bytes) throws BufferOverflowException, IllegalStateException
BytesPrepender
Note: it moves the readPosition not the writePosition / readLimit
prewrite
in interface BytesPrepender<Bytes<U>>
bytes
- to prepend to.BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> prewrite(@NotNull @NotNull BytesStore bytes) throws BufferOverflowException, IllegalStateException
BytesPrepender
Note: it moves the readPosition not the writePosition / readLimit
prewrite
in interface BytesPrepender<Bytes<U>>
bytes
- to prepend to.BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> prewriteByte(byte i8) throws BufferOverflowException, IllegalStateException
BytesPrepender
Note: it moves the readPosition not the writePosition / readLimit
prewriteByte
in interface BytesPrepender<Bytes<U>>
i8
- byte to prepend to.BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> prewriteInt(int i) throws BufferOverflowException, IllegalStateException
BytesPrepender
Note: it moves the readPosition not the writePosition / readLimit
prewriteInt
in interface BytesPrepender<Bytes<U>>
i
- integer to prepend to.BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> prewriteShort(short i) throws BufferOverflowException, IllegalStateException
BytesPrepender
Note: it moves the readPosition not the writePosition / readLimit
prewriteShort
in interface BytesPrepender<Bytes<U>>
i
- short to prepend to.BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> prewriteLong(long l) throws BufferOverflowException, IllegalStateException
BytesPrepender
Note: it moves the readPosition not the writePosition / readLimit
prewriteLong
in interface BytesPrepender<Bytes<U>>
l
- long to prepend to.BufferOverflowException
IllegalStateException
protected final long writeOffsetPositionMoved(long adding) throws BufferOverflowException, IllegalStateException
protected long writeOffsetPositionMoved(long adding, long advance) throws BufferOverflowException, IllegalStateException
protected void uncheckedWritePosition(long writePosition)
protected long prewriteOffsetPositionMoved(long subtracting) throws BufferOverflowException, IllegalStateException
@NotNull public @NotNull Bytes<U> writeShort(short i16) throws BufferOverflowException, IllegalStateException
writeShort
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> writeInt(int i) throws BufferOverflowException, IllegalStateException
writeInt
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> writeIntAdv(int i, int advance) throws BufferOverflowException, IllegalStateException
writeIntAdv
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> writeLong(long i64) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeLong
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> writeLongAdv(long i64, int advance) throws BufferOverflowException, IllegalStateException
writeLongAdv
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> writeFloat(float f) throws BufferOverflowException, IllegalStateException
writeFloat
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> writeDouble(double d) throws BufferOverflowException, IllegalStateException
writeDouble
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> writeDoubleAndInt(double d, int i) throws BufferOverflowException, IllegalStateException
writeDoubleAndInt
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
public int read(byte[] bytes, int off, int len) throws BufferUnderflowException, IllegalStateException
read
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
IllegalStateException
public long read(long offsetInRDI, byte[] bytes, int offset, int length) throws IllegalStateException
read
in interface RandomDataInput
IllegalStateException
@NotNull public @NotNull Bytes<U> write(byte[] byteArray, int offset, int length) throws BufferOverflowException, IllegalStateException, IllegalArgumentException
StreamingDataOutput
byteArray
into this Bytes object.
Invoking this method will update the cursors of this Bytes object.
write
in interface StreamingDataOutput<Bytes<U>>
IllegalArgumentException
- if the provided offset
or length
is negativeBufferOverflowException
IllegalStateException
protected int safeCopySize()
@NotNull public @NotNull Bytes<U> writeSome(@NotNull @NotNull ByteBuffer buffer) throws BufferOverflowException, IllegalStateException, BufferUnderflowException
StreamingDataOutput
Calling this method will update the cursors of this.
writeSome
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
BufferUnderflowException
@NotNull public @NotNull Bytes<U> writeBoolean(boolean flag) throws BufferOverflowException, IllegalStateException
writeBoolean
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> writeOrderedInt(int i) throws BufferOverflowException, IllegalStateException
writeOrderedInt
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> writeOrderedLong(long i) throws BufferOverflowException, IllegalStateException
writeOrderedLong
in interface StreamingDataOutput<Bytes<U>>
BufferOverflowException
IllegalStateException
public long addressForRead(long offset) throws BufferUnderflowException, IllegalStateException
offset
- within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.BufferUnderflowException
- if the offset is before the start() or the after the capacity()IllegalStateException
public long addressForWrite(long offset) throws BufferOverflowException, IllegalStateException
offset
- within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.BufferOverflowException
- if the offset is before the start() or the after the capacity()IllegalStateException
public long addressForWritePosition() throws BufferOverflowException, IllegalStateException
@NotNull public @NotNull String toString()
toString
in interface CharSequence
toString
in class net.openhft.chronicle.core.io.AbstractReferenceCounted
public void nativeRead(long position, long address, long size) throws BufferUnderflowException, IllegalStateException
RandomDataInput
nativeRead
in interface RandomDataInput
position
- within the ByteStore to copy.address
- in native memorysize
- in bytesBufferUnderflowException
- if the offset is outside the limits of the BytesIllegalStateException
- if releasedpublic void nativeWrite(long address, long position, long size) throws BufferOverflowException, IllegalStateException
RandomDataOutput
nativeWrite
in interface RandomDataOutput<Bytes<U>>
address
- in native memory to copy fromposition
- in BytesStore to copy tosize
- in bytesBufferOverflowException
IllegalStateException
@NotNull public @NotNull BytesStore bytesStore()
Bytes
bytesStore
in interface Bytes<U>
bytesStore
in interface BytesStore<Bytes<U>,U>
protected void bytesStore(BytesStore<Bytes<U>,U> bytesStore)
public int lastDecimalPlaces()
lastDecimalPlaces
in interface ByteStringParser<Bytes<U>>
public void lastDecimalPlaces(int lastDecimalPlaces)
ByteStringParser
lastDecimalPlaces
in interface ByteStringParser<Bytes<U>>
lastDecimalPlaces
- set the number of decimal places if positive, otherwise 0.public boolean lastNumberHadDigits()
lastNumberHadDigits
in interface ByteStringParser<Bytes<U>>
public void lastNumberHadDigits(boolean lastNumberHadDigits)
lastNumberHadDigits
in interface ByteStringParser<Bytes<U>>
lastNumberHadDigits
- set the last number had digitspublic BytesStore<Bytes<U>,U> copy() throws IllegalStateException
Bytes
RandomCommon.readPosition()
to RandomCommon.readLimit()
.copy
in interface Bytes<U>
copy
in interface BytesStore<Bytes<U>,U>
IllegalStateException
public boolean isElastic()
Bytes
Bytes.realCapacity()
.public void lenient(boolean lenient)
StreamingDataInput
false
and empty string.lenient
in interface StreamingDataInput<Bytes<U>>
lenient
- if true, return nothing rather than error.public boolean lenient()
lenient
in interface StreamingDataInput<Bytes<U>>
public int byteCheckSum() throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, IllegalStateException
BytesStore
byteCheckSum
in interface BytesStore<Bytes<U>,U>
IllegalStateException
- if the BytesStore has been releasednet.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowException
public int byteCheckSum(long start, long end) throws BufferUnderflowException, IllegalStateException
BytesStore
byteCheckSum
in interface BytesStore<Bytes<U>,U>
start
- the index of the first byte to sumend
- the index of the last byte to sumBufferUnderflowException
- if the specified indexes are outside the limits of the BytesStoreIllegalStateException
- if the BytesStore has been releasedpublic boolean startsWith(@Nullable @Nullable BytesStore bytesStore) throws IllegalStateException
BytesStore
startsWith
in interface BytesStore<Bytes<U>,U>
bytesStore
- the BytesStore to compare withtrue
if the content of this BytesStore starts with bytesStoreIllegalStateException
- if this BytesStore has been released@NotNull public @NotNull UncheckedRandomDataInput acquireUncheckedInput()
HasUncheckedRandomDataInput
acquireUncheckedInput
in interface HasUncheckedRandomDataInput
public int byteCheckSum(int start, int end) throws BufferUnderflowException, IllegalStateException
public boolean isImmutableEmptyByteStore()
BytesStore
isImmutableEmptyByteStore
in interface BytesStore<Bytes<U>,U>
public int copyTo(byte[] bytes) throws BufferUnderflowException, IllegalStateException
RandomDataInput
RandomCommon.readPosition()
to RandomCommon.readLimit()
.copyTo
in interface RandomDataInput
BufferUnderflowException
- if the offset is outside the limits of the BytesIllegalStateException
- if released@Deprecated public byte[] internalNumberBuffer()
internalNumberBuffer
in interface ByteStringAppender<Bytes<U>>
internalNumberBuffer
in interface RandomDataOutput<Bytes<U>>
internalNumberBuffer
in interface StreamingDataOutput<Bytes<U>>
Copyright © 2023. All rights reserved.