public static final class Volume.RandomAccessFileVol extends Volume
Volume.ByteArrayVol, Volume.ByteBufferVol, Volume.ByteBufferVolSingle, Volume.FileChannelVol, Volume.MappedFileVol, Volume.MappedFileVolSingle, Volume.MemoryVol, Volume.MemoryVolSingle, Volume.RandomAccessFileVol, Volume.ReadOnly, Volume.SingleByteArrayVol, Volume.VolumeFactory| Modifier and Type | Field and Description |
|---|---|
static Volume.VolumeFactory |
FACTORY |
protected File |
file |
protected FileLock |
fileLock |
protected RandomAccessFile |
raf |
closed, LOG, UNSAFE_VOL_FACTORY| Constructor and Description |
|---|
Volume.RandomAccessFileVol(File file,
boolean readOnly,
boolean fileLockDisable,
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(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) |
DataInput |
getDataInput(long offset,
int size) |
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) |
long |
hash(long off,
long len,
long seed)
Calculates XXHash64 from this Volume content.
|
boolean |
isSliced() |
long |
length() |
void |
putByte(long offset,
byte value) |
void |
putData(long offset,
byte[] src,
int srcPos,
int srcSize) |
void |
putData(long offset,
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, copyEntireVolumeTo, deleteFile, fileLoad, finalize, getDataInputOverlap, getLongPackBidi, getLongPackBidiReverse, getUnsignedByte, isClosed, putDataOverlap, putLongPackBidi, putUnsignedByte, transferInto, volumeTransferpublic static final Volume.VolumeFactory FACTORY
protected final File file
protected final RandomAccessFile raf
protected final FileLock fileLock
public Volume.RandomAccessFileVol(File file, boolean readOnly, boolean fileLockDisable, 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,
ByteBuffer buf)
public DataInput 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 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(RandomAccessFile raf, long startOffset, long endOffset) throws IOException
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 fromCopyright © 2015. All Rights Reserved.