B
- the type of BytesPrepender. This is a self-referential generic type parameter.public interface BytesPrepender<B extends BytesPrepender<B>>
This interface is generic and can be parameterized with any type that extends BytesPrepender.
Note: For all prepend and prewrite operations, the read position (but not the write position or read limit) is moved backward.
BufferOverflowException can occur if the capacity of the underlying buffer is exceeded during operation execution.
BufferOverflowException
,
IllegalStateException
Modifier and Type | Method and Description |
---|---|
B |
clearAndPad(long length)
Clears the buffer and pads it with a specified length to allow prepending later.
|
default B |
prepend(long value)
Prepends a long value as a decimal text.
|
B |
prewrite(byte[] bytes)
Writes a byte array backward in binary format.
|
B |
prewrite(BytesStore bytes)
Writes a BytesStore instance backward in binary format.
|
B |
prewriteByte(byte b)
Writes a byte backward in binary format.
|
B |
prewriteInt(int i)
Writes an int (4-byte int) backward in binary format.
|
B |
prewriteLong(long l)
Writes a long (8-byte int) backward in binary format.
|
B |
prewriteShort(short i)
Writes a short (2-byte int) backward in binary format.
|
@NotNull B clearAndPad(long length) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
length
- the padding lengthBufferOverflowException
- If the length is greater than the difference of capacity() and start()net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe way@NotNull default B prepend(long value) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
Note: The operation shifts the readPosition, but not the writePosition or readLimit
value
- the long value to prepend as textBufferOverflowException
- If the capacity of the underlying buffer was exceedednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe way@NotNull B prewrite(byte[] bytes) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
bytes
- the byte array to prependBufferOverflowException
- If the capacity of the underlying buffer was exceedednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe way.@NotNull B prewrite(BytesStore bytes) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
bytes
- the BytesStore to prependBufferOverflowException
- If the capacity of the underlying buffer was exceedednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe way.@NotNull B prewriteByte(byte b) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
b
- the byte to prependBufferOverflowException
- If the capacity of the underlying buffer was exceedednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe way.@NotNull B prewriteShort(short i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i
- the short to prependBufferOverflowException
- If the capacity of the underlying buffer was exceedednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe way.@NotNull B prewriteInt(int i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i
- the int to prependBufferOverflowException
- If the capacity of the underlying buffer was exceedednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe way.@NotNull B prewriteLong(long l) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
l
- the long to prependBufferOverflowException
- If the capacity of the underlying buffer was exceedednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe way.Copyright © 2024. All rights reserved.