public abstract class CommonMappedBytes extends MappedBytes
NOTE These Bytes are single Threaded as are all Bytes.
Modifier and Type | Field and Description |
---|---|
protected long |
lastActualSize |
protected MappedFile |
mappedFile |
TRACE
bytesStore, isPresent, readPosition, writeLimit, writePosition
referenceCounted, WARN_COUNT, WARN_NS
DEFAULT_BYTE_BUFFER_CAPACITY, MAX_CAPACITY, MAX_HEAP_CAPACITY
charToString
JAVA9_STRING_CODER_LATIN, JAVA9_STRING_CODER_UTF16
Modifier | Constructor and Description |
---|---|
protected |
CommonMappedBytes(@NotNull MappedFile mappedFile) |
protected |
CommonMappedBytes(@NotNull MappedFile mappedFile,
String name) |
Modifier and Type | Method and Description |
---|---|
@NotNull Bytes<Void> |
append8bit(@NotNull CharSequence text,
int start,
int end)
Appends a portion of a string to this Bytes in ISO-8859-1.
|
@NotNull Bytes<Void> |
appendUtf8(@NotNull CharSequence cs,
int start,
int length) |
long |
capacity() |
void |
chunkCount(long[] chunkCount) |
@NotNull Bytes<Void> |
clear()
Set the readPosition= writePosition = start, writeLimit = capacity
|
void |
clearUsedByThread() |
void |
close() |
BytesStore<Bytes<Void>,Void> |
copy()
Creates and returns a new copy of this Bytes object from
RandomCommon.readPosition()
to RandomCommon.readLimit() . |
CommonMappedBytes |
disableThreadSafetyCheck(boolean disableThreadSafetyCheck) |
boolean |
isBackingFileReadOnly() |
boolean |
isClosed() |
boolean |
isDirectMemory() |
@NotNull MappedFile |
mappedFile() |
protected void |
performRelease() |
@Nullable String |
read8bit() |
Bytes<Void> |
readLimitToCapacity() |
long |
readStopBit() |
char |
readStopBitChar() |
long |
realCapacity()
Returns the actual capacity that can be potentially read.
|
long |
realReadRemaining()
If the resource is closed, the returned value is unspecified.
|
void |
release(net.openhft.chronicle.core.io.ReferenceOwner id) |
void |
releaseLast(net.openhft.chronicle.core.io.ReferenceOwner id) |
long |
start() |
void |
throwExceptionIfClosed() |
@NotNull String |
toString() |
void |
warnAndCloseIfNotClosed() |
@NotNull CommonMappedBytes |
write(byte[] byteArray,
int offset,
int length)
Writes all data from the provided
byteArray into this Bytes object. |
@NotNull CommonMappedBytes |
write(long offsetInRDO,
@NotNull RandomDataInput bytes) |
@NotNull CommonMappedBytes |
write(@NotNull RandomDataInput bytes)
Write all data or fail.
|
@NotNull Bytes<Void> |
write(@NotNull RandomDataInput bytes,
long offset,
long length)
Write all data or fail.
|
@NotNull CommonMappedBytes |
write8bit(@NotNull CharSequence text,
int start,
int length) |
@NotNull Bytes<Void> |
writePosition(long position) |
@NotNull Bytes<Void> |
writeSkip(long bytesToSkip)
Skip a number of bytes by moving the writePosition.
|
@NotNull Bytes<Void> |
writeStopBit(char n) |
@NotNull Bytes<Void> |
writeStopBit(long n)
Write a stop bit encoded long
|
@NotNull Bytes<Void> |
writeUtf8(@Nullable CharSequence text)
Write the same encoding as
writeUTF with the following changes. |
@NotNull Bytes<Void> |
writeUtf8(@Nullable String text) |
mappedBytes, mappedBytes, mappedBytes, mappedBytes, mappedBytes, readOnly, sharedMemory, singleMappedBytes, singleMappedBytes, singleMappedBytes
acquireUncheckedInput, addressForRead, addressForWrite, addressForWritePosition, append, byteCheckSum, byteCheckSum, byteCheckSum, bytesStore, bytesStore, canReadDirect, canWriteDirect, clearAndPad, compact, compareAndSwapInt, compareAndSwapLong, equals, hashCode, isElastic, isImmutableEmptyByteStore, lastDecimalPlaces, lastDecimalPlaces, lastNumberHadDigits, lastNumberHadDigits, lenient, lenient, move, nativeRead, nativeWrite, peekUnsignedByte, peekUnsignedByte, prewrite, prewrite, prewriteByte, prewriteInt, prewriteLong, prewriteOffsetPositionMoved, prewriteShort, read, read, readByte, readByte, readCheckOffset, readDouble, readDouble, readFloat, readFloat, readInt, readInt, readLimit, readLimit, readLong, readLong, readOffsetPositionMoved, readPosition, readPosition, readShort, readShort, readSkip, readUnsignedByte, readUnsignedByte, readVolatileByte, readVolatileInt, readVolatileInt, readVolatileLong, readVolatileLong, readVolatileShort, safeCopySize, startsWith, testAndSetInt, uncheckedReadSkipBackOne, uncheckedReadSkipOne, uncheckedReadUnsignedByte, uncheckedWritePosition, underlyingObject, write, write, write, write8bit, write8bit, write8bit, write8bit, writeByte, writeByte, writeCheckOffset, writeDouble, writeDouble, writeDoubleAndInt, writeFloat, writeFloat, writeInt, writeInt, writeIntAdv, writeLimit, writeLimit, writeLong, writeLong, writeLongAdv, writeOffsetPositionMoved, writeOffsetPositionMoved, writeOrderedInt, writeOrderedInt, writeOrderedLong, writeOrderedLong, writePosition, writeShort, writeShort, writeSome, writeVolatileByte, writeVolatileInt, writeVolatileLong, writeVolatileShort
assertReferencesReleased, backgroundPerformRelease, canReleaseInBackground, createdHere, disableReferenceTracing, enableReferenceTracing, refCount, referenceId, reserve, reservedBy, reserveTransfer, threadSafetyCheck, throwExceptionIfNotReleased, throwExceptionIfReleased, tryReserve, unmonitor, warnAndReleaseIfNotReleased
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
allocateDirect, allocateDirect, allocateElasticDirect, allocateElasticDirect, allocateElasticOnHeap, allocateElasticOnHeap, bytesForRead, copyTo, copyTo, directFrom, elasticByteBuffer, elasticByteBuffer, elasticByteBuffer, elasticHeapByteBuffer, elasticHeapByteBuffer, ensureCapacity, forFieldGroup, from, from, fromDirect, fromHexString, indexOf, indexOf, isClear, isEqual, readBigDecimal, readBigInteger, readMarshallableLength16, readWithLength, readWrite, safeLimit, 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, bytesForWrite, charAt, cipher, cipher, compareAndSwapDouble, compareAndSwapFloat, contentEquals, elasticByteBuffer, empty, endsWith, equalBytes, forFields, from, hash, inside, inside, isEmpty, isEqual, lazyNativeBytesStoreWithFixedCapacity, length, 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, 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, readBoolean, readChar, readEnum, readHistogram, readIncompleteLong, readInt24, readPositionForHeader, readPositionRemaining, readPositionUnlimited, readStopBitDecimal, readStopBitDouble, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8, readUtf8, readUtf8, readWithLength, readWithLength, readWithLength0, unsafeRead, unsafeReadObject, unsafeReadObject
bytesMethodWriter, writeObject
append, append, append, append, append, append, append, append, append, append8bit, append8bit, append8bit, append8bit, appendBase, appendBase16, appendBase16, appendDateMillis, appendDecimal, appendTimeMillis, writer
appendUtf8, appendUtf8, appendUtf8, appendUtf8, appendUtf8, copyFrom, outputStream, rawWriteByte, rawWriteInt, rawWriteLong, unsafeWrite, unsafeWriteObject, unsafeWriteObject, write, write, write, write, write, write8bit, write8bit, writeBigDecimal, writeBigInteger, writeBoolean, writeChar, writeEnum, writeHistogram, writeInt24, writePositionForHeader, writePositionRemaining, writeSome, writeStopBit, writeStopBitDecimal, writeUnsignedByte, writeUnsignedInt, writeUnsignedInt24, writeUnsignedShort, writeWithLength
prepend
comment, indent, retainsComments
protected final MappedFile mappedFile
protected long lastActualSize
protected CommonMappedBytes(@NotNull @NotNull MappedFile mappedFile) throws IllegalStateException
IllegalStateException
protected CommonMappedBytes(@NotNull @NotNull MappedFile mappedFile, String name) throws IllegalStateException
IllegalStateException
public void clearUsedByThread()
clearUsedByThread
in class net.openhft.chronicle.core.io.AbstractReferenceCounted
@NotNull public @NotNull CommonMappedBytes write(byte[] byteArray, int offset, int length) throws IllegalStateException, BufferOverflowException
StreamingDataOutput
byteArray
into this Bytes object.
Invoking this method will update the cursors of this Bytes object.
write
in interface StreamingDataOutput<Bytes<Void>>
write
in class AbstractBytes<Void>
IllegalStateException
BufferOverflowException
@NotNull public @NotNull CommonMappedBytes 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<Void>>
write
in class AbstractBytes<Void>
IllegalStateException
BufferOverflowException
@NotNull public @NotNull CommonMappedBytes write(long offsetInRDO, @NotNull @NotNull RandomDataInput bytes) throws BufferOverflowException, IllegalStateException
@NotNull public @NotNull MappedFile mappedFile()
mappedFile
in class MappedBytes
public BytesStore<Bytes<Void>,Void> copy() throws IllegalStateException
Bytes
RandomCommon.readPosition()
to RandomCommon.readLimit()
.copy
in interface Bytes<Void>
copy
in interface BytesStore<Bytes<Void>,Void>
copy
in class AbstractBytes<Void>
IllegalStateException
public long capacity()
capacity
in interface BytesStore<Bytes<Void>,Void>
capacity
in class AbstractBytes<Void>
public long realReadRemaining()
If the resource is closed, the returned value is unspecified.
public long realCapacity()
RandomDataInput
realCapacity
in interface Bytes<Void>
realCapacity
in interface BytesStore<Bytes<Void>,Void>
realCapacity
in interface RandomDataInput
realCapacity
in interface StreamingDataOutput<Bytes<Void>>
realCapacity
in class AbstractBytes<Void>
@Nullable public @Nullable String read8bit() throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, IllegalStateException, ArithmeticException
net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowException
IllegalStateException
ArithmeticException
@NotNull public @NotNull Bytes<Void> writeSkip(long bytesToSkip) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeSkip
in interface StreamingDataOutput<Bytes<Void>>
writeSkip
in class AbstractBytes<Void>
bytesToSkip
- bytes to skip. This can be negative.BufferOverflowException
- if the offset is outside the limits of the BytesIllegalStateException
public long start()
start
in class AbstractBytes<Void>
@NotNull public @NotNull Bytes<Void> writePosition(long position) throws BufferOverflowException
writePosition
in interface StreamingDataOutput<Bytes<Void>>
writePosition
in class AbstractBytes<Void>
BufferOverflowException
@NotNull public @NotNull Bytes<Void> clear() throws IllegalStateException
StreamingCommon
clear
in interface Bytes<Void>
clear
in interface StreamingCommon<Bytes<Void>>
clear
in class AbstractBytes<Void>
IllegalStateException
- if this resource has been previously releasedprotected void performRelease()
performRelease
in class AbstractBytes<Void>
@NotNull public @NotNull Bytes<Void> write(@NotNull @NotNull RandomDataInput bytes, long offset, long length) throws BufferUnderflowException, BufferOverflowException, IllegalStateException
StreamingDataOutput
Calling this method will update the cursors of this, but not the bytes we read from.
@NotNull public @NotNull Bytes<Void> append8bit(@NotNull @NotNull CharSequence text, int start, int end) throws IllegalArgumentException, BufferOverflowException, BufferUnderflowException, IndexOutOfBoundsException, IllegalStateException
ByteStringAppender
text
- the CharSequence to appendstart
- index of the first char of cs (inclusive) to appendend
- index of the last char of cs (exclusive) to appendBufferOverflowException
- if the string is too large to write in the capacity availableBufferUnderflowException
- if the capacity of the underlying buffer was exceededIndexOutOfBoundsException
- if the start or the end are not valid for the CharSequenceIllegalArgumentException
IllegalStateException
@NotNull public @NotNull CommonMappedBytes write8bit(@NotNull @NotNull CharSequence text, int start, int length) throws IllegalStateException, BufferUnderflowException, BufferOverflowException, ArithmeticException, IndexOutOfBoundsException
@NotNull public @NotNull Bytes<Void> appendUtf8(@NotNull @NotNull CharSequence cs, int start, int length) throws BufferOverflowException, IllegalStateException, BufferUnderflowException, IndexOutOfBoundsException
public void release(net.openhft.chronicle.core.io.ReferenceOwner id) throws IllegalStateException
release
in interface net.openhft.chronicle.core.io.ReferenceCounted
release
in class net.openhft.chronicle.core.io.AbstractReferenceCounted
IllegalStateException
public void releaseLast(net.openhft.chronicle.core.io.ReferenceOwner id) throws IllegalStateException
releaseLast
in interface net.openhft.chronicle.core.io.ReferenceCounted
releaseLast
in class net.openhft.chronicle.core.io.AbstractReferenceCounted
IllegalStateException
public void close()
public boolean isClosed()
public void warnAndCloseIfNotClosed()
public void throwExceptionIfClosed() throws IllegalStateException
IllegalStateException
@NotNull public @NotNull Bytes<Void> writeUtf8(@Nullable @Nullable CharSequence text) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeUTF
with the following changes. 1) The length is stop bit encoded
i.e. one byte longer for short strings, but is not limited in length. 2) The string can be null.text
- the string value to be written. Can be null.BufferOverflowException
- if there is not enough space leftIllegalStateException
@NotNull public @NotNull Bytes<Void> writeUtf8(@Nullable @Nullable String text) throws BufferOverflowException, IllegalStateException
public long readStopBit() throws net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException, BufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
IllegalStateException
BufferUnderflowException
public char readStopBitChar() throws net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException, BufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
IllegalStateException
BufferUnderflowException
@NotNull public @NotNull Bytes<Void> writeStopBit(long n) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
n
- long to writeBufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<Void> writeStopBit(char n) throws BufferOverflowException, IllegalStateException
public boolean isBackingFileReadOnly()
isBackingFileReadOnly
in class MappedBytes
public boolean isDirectMemory()
isDirectMemory
in interface BytesStore<Bytes<Void>,Void>
isDirectMemory
in class AbstractBytes<Void>
public CommonMappedBytes disableThreadSafetyCheck(boolean disableThreadSafetyCheck)
disableThreadSafetyCheck
in class MappedBytes
@NotNull public @NotNull String toString()
toString
in interface CharSequence
toString
in class AbstractBytes<Void>
public void chunkCount(long[] chunkCount)
chunkCount
in class MappedBytes
Copyright © 2022. All rights reserved.