org.mapdb.volume / RandomAccessFileVol

RandomAccessFileVol

class RandomAccessFileVol : Volume

Created by jan on 2/29/16.



Constructors

<init> RandomAccessFileVol(file: File, readOnly: Boolean, fileLockWait: Long, initSize: Long)

Properties

FACTORY static val FACTORY: VolumeFactory

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 fun clear(startOffset: Long, endOffset: Long): Unit
close fun close(): Unit
ensureAvailable fun ensureAvailable(offset: Long): Unit
getByte fun getByte(offset: Long): Byte
getData fun getData(offset: Long, bytes: ByteArray, bytesPos: Int, size: Int): Unit
getDataInput fun getDataInput(offset: Long, size: Int): DataInput2
getFile fun getFile(): File
getFileLocked fun getFileLocked(): Boolean
getInt fun getInt(offset: Long): Int
getLong fun getLong(offset: Long): Long
getPackedLong fun getPackedLong(pos: Long): Long
getSixLong fun getSixLong(offset: Long): Long
getUnsignedShort fun getUnsignedShort(offset: Long): Int
isReadOnly fun isReadOnly(): Boolean
isSliced fun isSliced(): Boolean
length fun length(): Long
putByte fun putByte(offset: Long, value: Byte): Unit
putData fun putData(offset: Long, src: ByteArray, srcPos: Int, srcSize: Int): Unit
fun putData(offset: Long, buf: ByteBuffer): Unit
putInt fun putInt(offset: Long, value: Int): Unit
putLong fun putLong(offset: Long, value: Long): Unit
putPackedLong fun putPackedLong(pos: Long, value: Long): Int
putSixLong fun putSixLong(pos: Long, value: Long): Unit
putUnsignedShort fun putUnsignedShort(offset: Long, value: Int): Unit
sliceSize fun sliceSize(): Int
sync fun sync(): Unit
truncate fun truncate(size: Long): Unit

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
copyFrom open fun copyFrom(input: InputStream): Unit

Copy content from InputStream into this Volume.

copyTo open fun copyTo(inputOffset: Long, target: Volume, targetOffset: Long, size: Long): Unit

Transfers data from this Volume into target volume. If its possible, the implementation should override this method to enable direct memory transfer. Caller must respect slice boundaries. ie it is not possible to transfer data which cross slice boundaries.

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
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.

getDataInputOverlap open fun getDataInputOverlap(offset: Long, size: Int): DataInput2
getUnsignedByte open fun getUnsignedByte(offset: Long): Int
hash open fun hash(off: Long, len: Long, seed: Long): Long

Calculates XXHash64 from this Volume content.

isClosed open fun isClosed(): Boolean
putDataOverlap open fun putDataOverlap(offset: Long, src: ByteArray, srcPos: Int, srcSize: Int): Unit
putUnsignedByte open fun putUnsignedByte(offset: Long, b: Int): Unit