public final class FileChannelVol extends Volume
| Modifier and Type | Field and Description |
|---|---|
protected java.nio.channels.FileChannel |
channel |
static VolumeFactory |
FACTORY |
protected java.io.File |
file |
protected java.nio.channels.FileLock |
fileLock |
protected java.util.concurrent.locks.Lock |
growLock |
protected boolean |
readOnly |
protected long |
size |
protected int |
sliceSize |
closed, LOG, UNSAFE_VOL_FACTORY| Constructor and Description |
|---|
FileChannelVol(java.io.File file) |
FileChannelVol(java.io.File file,
boolean readOnly,
long fileLockWait,
int sliceShift,
long initSize) |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
checkFolder(java.io.File file,
boolean readOnly) |
static void |
clear(java.nio.channels.FileChannel channel,
long startOffset,
long endOffset) |
void |
clear(long startOffset,
long endOffset)
Set all bytes between
startOffset and endOffset to zero. |
void |
close() |
void |
ensureAvailable(long offset)
Check space allocated by Volume is bigger or equal to given offset.
|
byte |
getByte(long offset) |
void |
getData(long offset,
byte[] bytes,
int bytesPos,
int size) |
DataInput2.ByteBuffer |
getDataInput(long offset,
int size) |
java.io.File |
getFile()
returns underlying file if it exists
|
boolean |
getFileLocked()
return true if this Volume holds exclusive lock over its file
|
int |
getInt(long offset) |
long |
getLong(long offset) |
boolean |
isReadOnly() |
boolean |
isSliced() |
long |
length() |
void |
putByte(long offset,
byte value) |
void |
putData(long offset,
byte[] src,
int srcPos,
int srcSize) |
void |
putData(long offset,
java.nio.ByteBuffer buf) |
void |
putInt(long offset,
int value) |
void |
putLong(long offset,
long value) |
protected void |
readFully(long offset,
java.nio.ByteBuffer buf) |
int |
sliceSize() |
void |
sync() |
void |
truncate(long size) |
protected void |
writeFully(long offset,
java.nio.ByteBuffer buf) |
assertZeroes, clearOverlap, copyFrom, copyTo, copyTo, copyTo, deleteFile, fileLoad, finalize, getDataInputOverlap, getPackedLong, getSixLong, getUnsignedByte, getUnsignedShort, hash, isClosed, putDataOverlap, putPackedLong, putSixLong, putUnsignedByte, putUnsignedShortpublic static final VolumeFactory FACTORY
protected final java.io.File file
protected final int sliceSize
protected java.nio.channels.FileChannel channel
protected final boolean readOnly
protected final java.nio.channels.FileLock fileLock
protected volatile long size
protected final java.util.concurrent.locks.Lock growLock
public FileChannelVol(java.io.File file,
boolean readOnly,
long fileLockWait,
int sliceShift,
long initSize)
public FileChannelVol(java.io.File file)
protected static void checkFolder(java.io.File file,
boolean readOnly)
throws java.io.IOException
java.io.IOExceptionpublic void ensureAvailable(long offset)
VolumeensureAvailable in class Volumeprotected void writeFully(long offset,
java.nio.ByteBuffer buf)
public void putData(long offset,
byte[] src,
int srcPos,
int srcSize)
public void putData(long offset,
java.nio.ByteBuffer buf)
protected void readFully(long offset,
java.nio.ByteBuffer buf)
public DataInput2.ByteBuffer getDataInput(long offset, int size)
getDataInput in class Volumepublic void getData(long offset,
byte[] bytes,
int bytesPos,
int size)
public void close()
public int sliceSize()
public boolean isReadOnly()
isReadOnly in class Volumepublic java.io.File getFile()
Volumepublic boolean getFileLocked()
VolumegetFileLocked in class Volumepublic void clear(long startOffset,
long endOffset)
VolumestartOffset and endOffset to zero.
Area between offsets must be ready for write once clear finishes.public static void clear(java.nio.channels.FileChannel channel,
long startOffset,
long endOffset)
Copyright © 2018. All Rights Reserved.