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, putUnsignedByte
public 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)
Volume
ensureAvailable
in class Volume
public 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 Volume
public void getData(long offset, byte[] bytes, int bytesPos, int size)
public void close()
public int sliceSize()
public java.io.File getFile()
Volume
public boolean getFileLocked()
Volume
getFileLocked
in class Volume
public void clear(long startOffset, long endOffset)
Volume
startOffset
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.IOException
public void putUnsignedShort(long offset, int value)
putUnsignedShort
in class Volume
public int getUnsignedShort(long offset)
getUnsignedShort
in class Volume
public long getSixLong(long offset)
getSixLong
in class Volume
public void putSixLong(long pos, long value)
putSixLong
in class Volume
public int putPackedLong(long pos, long value)
Volume
putPackedLong
in class Volume
value
- to be writtenpublic long getPackedLong(long pos)
Volume
result & DataIO.PACK_LONG_RESULT_MASK
to remove size;getPackedLong
in class Volume
pos
- to read value frompublic boolean isReadOnly()
isReadOnly
in class Volume
Copyright © 2018. All Rights Reserved.