Documentation of 'org.mapdb.Volume' Java class
Volume
org.mapdb

Class Volume

    • Field Detail

      • UNSAFE_VOL_FACTORY

        public static final Volume.VolumeFactory UNSAFE_VOL_FACTORY
        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.
    • Constructor Detail

      • Volume

        public Volume()
    • Method Detail

      • fileLoad

        public boolean fileLoad()

        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.

        Returns:
        true if this method did something, false if underlying storage does not support loading
      • isClosed

        public boolean isClosed()
      • ensureAvailable

        public abstract void ensureAvailable(long offset)
        Check space allocated by Volume is bigger or equal to given offset. So it is safe to write into smaller offsets.
        Parameters:
        offset -
      • truncate

        public abstract void truncate(long size)
      • putLong

        public abstract void putLong(long offset,
                                     long value)
      • putInt

        public abstract void putInt(long offset,
                                    int value)
      • putByte

        public abstract void putByte(long offset,
                                     byte value)
      • putData

        public abstract void putData(long offset,
                                     byte[] src,
                                     int srcPos,
                                     int srcSize)
      • putData

        public abstract void putData(long offset,
                                     java.nio.ByteBuffer buf)
      • putDataOverlap

        public void putDataOverlap(long offset,
                                   byte[] src,
                                   int srcPos,
                                   int srcSize)
      • getLong

        public abstract long getLong(long offset)
      • getInt

        public abstract int getInt(long offset)
      • getByte

        public abstract byte getByte(long offset)
      • getDataInput

        public abstract java.io.DataInput getDataInput(long offset,
                                                       int size)
      • getDataInputOverlap

        public java.io.DataInput getDataInputOverlap(long offset,
                                                     int size)
      • getData

        public abstract void getData(long offset,
                                     byte[] bytes,
                                     int bytesPos,
                                     int size)
      • close

        public abstract void close()
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface java.lang.AutoCloseable
      • sync

        public abstract void sync()
      • sliceSize

        public abstract int sliceSize()
        Returns:
        slice size or -1 if not sliced
      • deleteFile

        public void deleteFile()
      • isSliced

        public abstract boolean isSliced()
      • length

        public abstract long length()
      • putUnsignedShort

        public void putUnsignedShort(long offset,
                                     int value)
      • getUnsignedShort

        public int getUnsignedShort(long offset)
      • getUnsignedByte

        public int getUnsignedByte(long offset)
      • putUnsignedByte

        public void putUnsignedByte(long offset,
                                    int b)
      • putLongPackBidi

        public int putLongPackBidi(long offset,
                                   long value)
      • getLongPackBidi

        public long getLongPackBidi(long offset)
      • getLongPackBidiReverse

        public long getLongPackBidiReverse(long offset)
      • getSixLong

        public long getSixLong(long pos)
      • putSixLong

        public void putSixLong(long pos,
                               long value)
      • putPackedLong

        public int putPackedLong(long pos,
                                 long value)
        Put packed long at given position.
        Parameters:
        value - to be written
        Returns:
        number of bytes consumed by packed value
      • getPackedLong

        public long getPackedLong(long position)
        Unpack long value from the Volume. Highest 4 bits reused to indicate number of bytes read from Volume. One can use result & DataIO.PACK_LONG_RESULT_MASK to remove size;
        Parameters:
        position - to read value from
        Returns:
        The long value, minus highest byte
      • getFile

        public abstract java.io.File getFile()
        returns underlying file if it exists
      • getFileLocked

        public abstract boolean getFileLocked()
        return true if this Volume holds exclusive lock over its file
      • transferInto

        public void transferInto(long inputOffset,
                                 Volume target,
                                 long targetOffset,
                                 long size)
        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.
        Parameters:
        inputOffset - offset inside this Volume, ie data will be read from this offset
        target - Volume to copy data into
        targetOffset - position in target volume where data will be copied into
        size - size of data to copy
      • clear

        public abstract void clear(long startOffset,
                                   long endOffset)
        Set all bytes between startOffset and endOffset to zero. Area between offsets must be ready for write once clear finishes.
      • copyEntireVolumeTo

        public void copyEntireVolumeTo(Volume to)
        Copy content of this volume to another. Target volume might grow, but is never shrank. Target is also not synced
      • hash

        public long hash(long off,
                         long len,
                         long seed)

        Calculates XXHash64 from this Volume content.

        This code comes from LZ4-Java created by Adrien Grand.

        Parameters:
        off - offset to start calculation from
        len - length of data to calculate hash
        seed - hash seed
        Returns:
        XXHash.
      • volumeTransfer

        public static void volumeTransfer(long size,
                                          Volume from,
                                          Volume to)
        transfer data from one volume to second. Second volume will be expanded if needed

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.