public abstract class MappedBytes extends AbstractBytes<Void> implements net.openhft.chronicle.core.io.Closeable, net.openhft.chronicle.core.io.ManagedCloseable, net.openhft.chronicle.core.io.Syncable
Memory is grouped in chunks of 64 MB by default. The chunk size can be increased greatly if the OS.isSparseFileSupported() e.g. blockSize(512 << 30)
The chunk containing the most recent accessed memory is reserved and the previous chunk is released. For random access, you can reserve a chunk by obtaining the bytesStore() and using reserve(owner) on it, remembering to release(owner) the same BytesStore before closing the file.
NOTE These MappedBytes are single threaded as are all Bytes.
Modifier and Type | Field and Description |
---|---|
protected static boolean |
TRACE |
bytesStore, DISABLE_THREAD_SAFETY, 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 |
MappedBytes() |
protected |
MappedBytes(String name) |
Modifier and Type | Method and Description |
---|---|
abstract void |
chunkCount(long[] chunkCount) |
abstract MappedBytes |
disableThreadSafetyCheck(boolean disableThreadSafetyCheck)
Deprecated.
|
abstract boolean |
isBackingFileReadOnly() |
static @NotNull MappedBytes |
mappedBytes(@NotNull File file,
long chunkSize) |
static @NotNull MappedBytes |
mappedBytes(@NotNull File file,
long chunkSize,
long overlapSize) |
static @NotNull MappedBytes |
mappedBytes(@NotNull File file,
long chunkSize,
long overlapSize,
boolean readOnly) |
static @NotNull MappedBytes |
mappedBytes(@NotNull MappedFile rw) |
static @NotNull MappedBytes |
mappedBytes(@NotNull String filename,
long chunkSize) |
abstract MappedFile |
mappedFile() |
static @NotNull MappedBytes |
readOnly(@NotNull File file) |
boolean |
sharedMemory()
Returns if this Bytes object is using memory that can be shared across processes.
|
static @NotNull MappedBytes |
singleMappedBytes(@NotNull File file,
long capacity) |
static @NotNull MappedBytes |
singleMappedBytes(@NotNull File file,
long capacity,
boolean readOnly) |
static @NotNull MappedBytes |
singleMappedBytes(@NotNull String filename,
long capacity) |
void |
sync() |
acquireUncheckedInput, addressForRead, addressForWrite, addressForWritePosition, append, byteCheckSum, byteCheckSum, byteCheckSum, bytesStore, bytesStore, canReadDirect, canWriteDirect, capacity, clear, clearAndPad, compact, compareAndSwapInt, compareAndSwapLong, copy, equals, hashCode, isDirectMemory, isElastic, isImmutableEmptyByteStore, lastDecimalPlaces, lastDecimalPlaces, lastNumberHadDigits, lastNumberHadDigits, lenient, lenient, move, nativeRead, nativeWrite, peekUnsignedByte, peekUnsignedByte, performRelease, 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, realCapacity, safeCopySize, start, startsWith, testAndSetInt, toString, uncheckedReadSkipBackOne, uncheckedReadSkipOne, uncheckedReadUnsignedByte, uncheckedWritePosition, underlyingObject, write, write, 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, writePosition, writeShort, writeShort, writeSkip, writeSome, writeVolatileByte, writeVolatileInt, writeVolatileLong, writeVolatileShort
assertReferencesReleased, backgroundPerformRelease, canReleaseInBackground, clearUsedByThread, createdHere, disableReferenceTracing, enableReferenceTracing, refCount, referenceId, release, releaseLast, reserve, reservedBy, reserveTransfer, singleThreadedCheckDisabled, singleThreadedCheckReset, threadSafetyCheck, throwExceptionIfNotReleased, throwExceptionIfReleased, tryReserve, unmonitor, warnAndReleaseIfNotReleased
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
createdHere, throwExceptionIfClosed, warnAndCloseIfNotClosed
close, closeQuietly, closeQuietly
allocateDirect, allocateDirect, allocateElasticDirect, allocateElasticDirect, allocateElasticOnHeap, allocateElasticOnHeap, bytesForRead, copyTo, copyTo, directFrom, elasticByteBuffer, elasticByteBuffer, elasticByteBuffer, elasticHeapByteBuffer, elasticHeapByteBuffer, empty, 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, 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, read8bit, readBoolean, readChar, readEnum, readHistogram, readIncompleteLong, readInt24, readLimitToCapacity, readPositionForHeader, 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, 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, write, write8bit, write8bit, write8bit, writeBigDecimal, writeBigInteger, writeBoolean, writeChar, writeEnum, writeHistogram, writeInt24, writePositionForHeader, writePositionRemaining, writeSome, writeStopBit, writeStopBit, writeStopBit, writeStopBitDecimal, writeUnsignedByte, writeUnsignedInt, writeUnsignedInt24, writeUnsignedShort, writeUtf8, writeUtf8, writeWithLength
prepend
comment, indent, retainsComments
protected MappedBytes() throws IllegalStateException
IllegalStateException
protected MappedBytes(String name) throws IllegalStateException
IllegalStateException
@NotNull public static @NotNull MappedBytes singleMappedBytes(@NotNull @NotNull String filename, long capacity) throws FileNotFoundException, IllegalStateException
@NotNull public static @NotNull MappedBytes singleMappedBytes(@NotNull @NotNull File file, long capacity) throws FileNotFoundException, IllegalStateException
@NotNull public static @NotNull MappedBytes singleMappedBytes(@NotNull @NotNull File file, long capacity, boolean readOnly) throws FileNotFoundException, IllegalStateException
@NotNull public static @NotNull MappedBytes mappedBytes(@NotNull @NotNull String filename, long chunkSize) throws FileNotFoundException, IllegalStateException
@NotNull public static @NotNull MappedBytes mappedBytes(@NotNull @NotNull File file, long chunkSize) throws FileNotFoundException, IllegalStateException
@NotNull public static @NotNull MappedBytes mappedBytes(@NotNull @NotNull File file, long chunkSize, long overlapSize) throws FileNotFoundException, IllegalStateException
@NotNull public static @NotNull MappedBytes mappedBytes(@NotNull @NotNull File file, long chunkSize, long overlapSize, boolean readOnly) throws FileNotFoundException, IllegalStateException
@NotNull public static @NotNull MappedBytes mappedBytes(@NotNull @NotNull MappedFile rw) throws IllegalStateException
IllegalStateException
@NotNull public static @NotNull MappedBytes readOnly(@NotNull @NotNull File file) throws FileNotFoundException
FileNotFoundException
public abstract boolean isBackingFileReadOnly()
public boolean sharedMemory()
Bytes
A Bytes object that is backed by a memory mapped file can be shared whereas a Bytes object that is backed by heap memory cannot be shared across processes.
sharedMemory
in interface Bytes<Void>
@Deprecated public abstract MappedBytes disableThreadSafetyCheck(boolean disableThreadSafetyCheck)
public abstract void chunkCount(long[] chunkCount)
public abstract MappedFile mappedFile()
public void sync()
sync
in interface net.openhft.chronicle.core.io.Syncable
Copyright © 2022. All rights reserved.