org.mapdb.volume / ByteBufferVol

ByteBufferVol

abstract class ByteBufferVol : Volume

Abstract Volume over bunch of ByteBuffers It leaves ByteBufferVol details (allocation, disposal) on subclasses. Most methods are final for better performance (JIT compiler can inline those).



Inherited Properties

UNSAFE_VOL_FACTORY static val UNSAFE_VOL_FACTORY: VolumeFactory

If sun.misc.Unsafe is available it will use Volume based on Unsafe. If Unsafe is not available for some reason (Android), use DirectByteBuffer instead.

Functions

clear open fun clear(startOffset: Long, endOffset: Long): Unit
copyTo open fun copyTo(inputOffset: Long, target: Volume, targetOffset: Long, size: Long): Unit
getByte fun getByte(offset: Long): Byte
getData open fun getData(offset: Long, src: ByteArray, srcPos: Int, srcSize: Int): Unit
getDataInput fun getDataInput(offset: Long, size: Int): ByteBuffer
getDataInputOverlap open fun getDataInputOverlap(offset: Long, size: Int): DataInput2
getInt fun getInt(offset: Long): Int
getLong fun getLong(offset: Long): Long
getPackedLong open fun getPackedLong(position: Long): Long
getSixLong open fun getSixLong(pos: Long): Long
getUnsignedByte open fun getUnsignedByte(offset: Long): Int
getUnsignedShort open fun getUnsignedShort(offset: Long): Int
isSliced open fun isSliced(): Boolean
putByte fun putByte(offset: Long, value: Byte): Unit
putData open fun putData(offset: Long, src: ByteArray, srcPos: Int, srcSize: Int): Unit
fun putData(offset: Long, buf: ByteBuffer): Unit
putDataOverlap open fun putDataOverlap(offset: Long, data: ByteArray, pos: Int, len: Int): Unit
putInt fun putInt(offset: Long, value: Int): Unit
putLong fun putLong(offset: Long, value: Long): Unit
putPackedLong open fun putPackedLong(pos: Long, value: Long): Int
putSixLong open fun putSixLong(pos: Long, value: Long): Unit
putUnsignedByte open fun putUnsignedByte(offset: Long, byt: Int): Unit
putUnsignedShort open fun putUnsignedShort(offset: Long, value: Int): Unit
sliceSize open fun sliceSize(): Int

Inherited Functions

assertZeroes open fun assertZeroes(startOffset: Long, endOffset: Long): Unit

Check that all bytes between given offsets are zero. This might cross 1MB boundaries

clearOverlap open fun clearOverlap(startOffset: Long, endOffset: Long): Unit
close abstract fun close(): Unit
copyFrom open fun copyFrom(input: InputStream): Unit

Copy content from InputStream into this Volume.

copyTo open fun copyTo(to: Volume): Unit

Copy content of this volume to another. Target volume might grow, but is never shrank. Target is also not synced

open fun copyTo(output: OutputStream): Unit

Copy content of this volume to OutputStream.

deleteFile open fun deleteFile(): Unit
ensureAvailable abstract fun ensureAvailable(offset: Long): Unit

Check space allocated by Volume is bigger or equal to given offset. So it is safe to write into smaller offsets.

fileLoad open fun fileLoad(): Boolean

If underlying storage is memory-mapped-file, this method will try to load and precache all file data into disk cache. Most likely it will call MappedByteBuffer#load(), but could also read content of entire file etc This method will not pin data into memory, they might be removed at any time.

getFile abstract fun getFile(): File

returns underlying file if it exists

getFileLocked abstract fun getFileLocked(): Boolean

return true if this Volume holds exclusive lock over its file

hash open fun hash(off: Long, len: Long, seed: Long): Long

Calculates XXHash64 from this Volume content.

isClosed open fun isClosed(): Boolean
isReadOnly abstract fun isReadOnly(): Boolean
length abstract fun length(): Long
sync abstract fun sync(): Unit
truncate abstract fun truncate(size: Long): Unit

Inheritors

ByteBufferMemoryVol class ByteBufferMemoryVol : ByteBufferVol

Created by jan on 3/13/16.

MappedFileVol class MappedFileVol : ByteBufferVol

Created by jan on 2/29/16.