|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkrati.core.array.basic.ArrayFile
public class ArrayFile
ArrayFile is not thread safe.
Version 0: +--------------------------+ |Header | |--------------------------| |Storage Version | long | |LWM Scn | long | |HWM Scn | long | |Array Length | int | |Data Element Size | int | |--------------------------| | Array data begins at 1024| | | +--------------------------+
Field Summary | |
---|---|
static int |
ARRAY_HEADER_LENGTH
|
static long |
STORAGE_VERSION
|
Constructor Summary | |
---|---|
ArrayFile(File file,
int initialLength,
int elementSize)
Creates a new ArrayFile based on a given length and element size. |
Method Summary | ||
---|---|---|
void |
close()
|
|
protected DataWriter |
createWriter(File file,
long fileLength)
|
|
void |
flush()
|
|
String |
getAbsolutePath()
|
|
int |
getArrayLength()
|
|
String |
getCanonicalPath()
|
|
int |
getElementSize()
|
|
long |
getHwmScn()
|
|
long |
getLwmScn()
|
|
String |
getName()
|
|
String |
getPath()
|
|
protected long |
getPosition(int index)
|
|
long |
getVersion()
|
|
protected void |
initCheck()
|
|
void |
load(MemoryIntArray intArray)
Load data into a memory-based int array. |
|
void |
load(MemoryLongArray longArray)
Load data into a memory-based long array. |
|
void |
load(MemoryShortArray shortArray)
Load data into a memory-based short array. |
|
int[] |
loadIntArray()
Load the main array. |
|
long[] |
loadLongArray()
Load the main array. |
|
short[] |
loadShortArray()
Load the main array. |
|
void |
reset(int[] intArray)
|
|
void |
reset(int[] intArray,
long maxScn)
|
|
void |
reset(long[] longArray)
|
|
void |
reset(long[] longArray,
long maxScn)
|
|
void |
reset(MemoryIntArray intArray)
|
|
void |
reset(MemoryIntArray intArray,
long maxScn)
|
|
void |
reset(MemoryLongArray longArray)
|
|
void |
reset(MemoryLongArray longArray,
long maxScn)
|
|
void |
reset(MemoryShortArray shortArray)
|
|
void |
reset(MemoryShortArray shortArray,
long maxScn)
|
|
void |
reset(short[] shortArray)
|
|
void |
reset(short[] shortArray,
long maxScn)
|
|
void |
setArrayLength(int arrayLength,
File renameToFile)
|
|
|
update(List<Entry<T>> entryList)
Apply entries to the array file. |
|
protected void |
writeArrayLength(int value)
|
|
protected void |
writeElementSize(int value)
|
|
protected void |
writeHwmScn(long value)
|
|
void |
writeInt(int index,
int value)
Writes an int value at a specified index in the array. |
|
void |
writeLong(int index,
long value)
Writes a long value at a specified index in the array. |
|
protected void |
writeLwmScn(long value)
|
|
void |
writeShort(int index,
short value)
Writes a short value at a specified index in the array. |
|
protected void |
writeVersion(long value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long STORAGE_VERSION
public static final int ARRAY_HEADER_LENGTH
Constructor Detail |
---|
public ArrayFile(File file, int initialLength, int elementSize) throws IOException
file
- the file on diskinitialLength
- the initial length (number of elements) of arrayelementSize
- the size (number of bytes) of every array element
IOException
Method Detail |
---|
protected DataWriter createWriter(File file, long fileLength)
protected void initCheck() throws IOException
IOException
public final String getName()
public final String getPath()
public final String getAbsolutePath()
public final String getCanonicalPath() throws IOException
IOException
public final long getVersion()
public final long getLwmScn()
public final long getHwmScn()
public final int getArrayLength()
public final int getElementSize()
public void flush() throws IOException
IOException
public void close() throws IOException
IOException
public void load(MemoryIntArray intArray) throws IOException
IOException
public void load(MemoryLongArray longArray) throws IOException
IOException
public void load(MemoryShortArray shortArray) throws IOException
IOException
public int[] loadIntArray() throws IOException
IOException
public long[] loadLongArray() throws IOException
IOException
public short[] loadShortArray() throws IOException
IOException
protected long getPosition(int index)
public void writeInt(int index, int value) throws IOException
index
- an index in the array.value
- int value
IOException
public void writeLong(int index, long value) throws IOException
index
- an index in the array.value
- long value
IOException
public void writeShort(int index, short value) throws IOException
index
- an index in the array.value
- short value
IOException
public <T extends EntryValue> void update(List<Entry<T>> entryList) throws IOException
entryList
-
IOException
protected void writeVersion(long value) throws IOException
IOException
protected void writeLwmScn(long value) throws IOException
IOException
protected void writeHwmScn(long value) throws IOException
IOException
protected void writeArrayLength(int value) throws IOException
IOException
protected void writeElementSize(int value) throws IOException
IOException
public void reset(MemoryIntArray intArray) throws IOException
IOException
public void reset(MemoryIntArray intArray, long maxScn) throws IOException
IOException
public void reset(MemoryLongArray longArray) throws IOException
IOException
public void reset(MemoryLongArray longArray, long maxScn) throws IOException
IOException
public void reset(MemoryShortArray shortArray) throws IOException
IOException
public void reset(MemoryShortArray shortArray, long maxScn) throws IOException
IOException
public void reset(int[] intArray) throws IOException
IOException
public void reset(int[] intArray, long maxScn) throws IOException
IOException
public void reset(long[] longArray) throws IOException
IOException
public void reset(long[] longArray, long maxScn) throws IOException
IOException
public void reset(short[] shortArray) throws IOException
IOException
public void reset(short[] shortArray, long maxScn) throws IOException
IOException
public void setArrayLength(int arrayLength, File renameToFile) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |