org.mapdb
Class Volume.ByteBufferVol
java.lang.Object
org.mapdb.Volume
org.mapdb.Volume.ByteBufferVol
- Direct Known Subclasses:
- Volume.MappedFileVol, Volume.MemoryVol
- Enclosing class:
- Volume
public abstract static class Volume.ByteBufferVol
- extends 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).
|
Constructor Summary |
protected |
Volume.ByteBufferVol(boolean readOnly,
long sizeLimit,
int chunkShift)
|
| Methods inherited from class org.mapdb.Volume |
close, deleteFile, ensureAvailable, fileFactory, fileFactory, getFile, getPackedLong, getSixLong, getUnsignedByte, getUnsignedShort, memoryFactory, putPackedLong, putSixLong, putUnsignedByte, putUnsignedShort, sync, truncate, volumeForFile, volumeTransfer |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
growLock
protected final ReentrantLock growLock
sizeLimit
protected final long sizeLimit
hasLimit
protected final boolean hasLimit
chunkShift
protected final int chunkShift
chunkSizeModMask
protected final int chunkSizeModMask
chunkSize
protected final int chunkSize
chunks
protected volatile ByteBuffer[] chunks
readOnly
protected final boolean readOnly
Volume.ByteBufferVol
protected Volume.ByteBufferVol(boolean readOnly,
long sizeLimit,
int chunkShift)
tryAvailable
public final boolean tryAvailable(long offset)
- Specified by:
tryAvailable in class Volume
makeNewBuffer
protected abstract ByteBuffer makeNewBuffer(long offset)
putLong
public final void putLong(long offset,
long value)
- Specified by:
putLong in class Volume
putInt
public final void putInt(long offset,
int value)
- Specified by:
putInt in class Volume
putByte
public final void putByte(long offset,
byte value)
- Specified by:
putByte in class Volume
putData
public void putData(long offset,
byte[] src,
int srcPos,
int srcSize)
- Specified by:
putData in class Volume
putData
public final void putData(long offset,
ByteBuffer buf)
- Specified by:
putData in class Volume
getLong
public final long getLong(long offset)
- Specified by:
getLong in class Volume
getInt
public final int getInt(long offset)
- Specified by:
getInt in class Volume
getByte
public final byte getByte(long offset)
- Specified by:
getByte in class Volume
getDataInput
public final DataInput2 getDataInput(long offset,
int size)
- Specified by:
getDataInput in class Volume
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in class Volume
isSliced
public boolean isSliced()
- Specified by:
isSliced in class Volume
unmap
protected void unmap(MappedByteBuffer b)
- Hack to unmap MappedByteBuffer.
Unmap is necessary on Windows, otherwise file is locked until JVM exits or BB is GCed.
There is no public JVM API to unmap buffer, so this tries to use SUN proprietary API for unmap.
Any error is silently ignored (for example SUN API does not exist on Android).
Copyright © 2014. All Rights Reserved.