public final class RandomAccessFileVol extends Volume
| Modifier and Type | Field and Description |
|---|---|
static VolumeFactory |
FACTORY |
protected java.io.File |
file |
protected java.nio.channels.FileLock |
fileLock |
protected java.io.RandomAccessFile |
raf |
protected boolean |
readOnly |
closed, LOG, UNSAFE_VOL_FACTORY| Constructor and Description |
|---|
RandomAccessFileVol(java.io.File file,
boolean readOnly,
long fileLockWait,
long initSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear(long startOffset,
long endOffset)
Set all bytes between
startOffset and endOffset to zero. |
protected static void |
clearRAF(java.io.RandomAccessFile raf,
long startOffset,
long endOffset) |
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 |
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) |
long |
getPackedLong(long pos)
Unpack long value from the Volume.
|
long |
getSixLong(long offset) |
int |
getUnsignedShort(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) |
int |
putPackedLong(long pos,
long value)
Put packed long at given position.
|
void |
putSixLong(long pos,
long value) |
void |
putUnsignedShort(long offset,
int value) |
int |
sliceSize() |
void |
sync() |
void |
truncate(long size) |
assertZeroes, clearOverlap, copyFrom, copyTo, copyTo, copyTo, deleteFile, fileLoad, finalize, getDataInputOverlap, getUnsignedByte, hash, isClosed, putDataOverlap, putUnsignedBytepublic static final VolumeFactory FACTORY
protected final java.io.File file
protected final java.io.RandomAccessFile raf
protected final java.nio.channels.FileLock fileLock
protected final boolean readOnly
public RandomAccessFileVol(java.io.File file,
boolean readOnly,
long fileLockWait,
long initSize)
public void ensureAvailable(long offset)
VolumeensureAvailable in class Volumepublic void putData(long offset,
byte[] src,
int srcPos,
int srcSize)
public void putData(long offset,
java.nio.ByteBuffer buf)
public DataInput2 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 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.protected static void clearRAF(java.io.RandomAccessFile raf,
long startOffset,
long endOffset)
throws java.io.IOException
java.io.IOExceptionpublic void putUnsignedShort(long offset,
int value)
putUnsignedShort in class Volumepublic int getUnsignedShort(long offset)
getUnsignedShort in class Volumepublic long getSixLong(long offset)
getSixLong in class Volumepublic void putSixLong(long pos,
long value)
putSixLong in class Volumepublic int putPackedLong(long pos,
long value)
VolumeputPackedLong in class Volumevalue - to be writtenpublic long getPackedLong(long pos)
Volumeresult & DataIO.PACK_LONG_RESULT_MASK to remove size;getPackedLong in class Volumepos - to read value frompublic boolean isReadOnly()
isReadOnly in class VolumeCopyright © 2018. All Rights Reserved.