public class HeapModifier extends HeapReader implements BLOB
HeapReader.entries, HeapReader.entry
BLOB.Reducer, BLOB.Rewriter
Constructor and Description |
---|
HeapModifier(java.io.File heapFile,
int keylength,
ByteOrder ordering)
create a heap file: a arbitrary number of BLOBs, indexed by an access key
The heap file will be indexed upon initialization.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
clears the content of the database
|
void |
close() |
void |
close(boolean writeIDX)
close the BLOB table
|
void |
delete(byte[] key)
remove a BLOB
|
void |
finalize() |
void |
insert(byte[] key,
byte[] b)
write a whole byte array as BLOB to the table
|
private void |
mergeGaps(long seek0,
int size0,
long seek1,
int size1) |
int |
reduce(byte[] key,
BLOB.Reducer reducer)
a reduce method is the same as the replace.
|
int |
replace(byte[] key,
BLOB.Rewriter rewriter)
replace an existing entry in the BLOB with a new entry
this method is similar to put, but it is necessary that a blob entry existed before
and contains an entry of same size or bigger than the new entry.
|
protected void |
shrinkWithGapsAtEnd() |
private void |
tryMergeNextGaps(long thisSeek,
int thisSize) |
private void |
tryMergePreviousGap(long thisSeek) |
checkKey, containsKey, deleteFingerprint, fingerprintFileHash, first, firstKey, get, get, isEmpty, keylength, keys, keys, last, lastKey, length, length, location, main, mem, name, normalizeKey, normalizeKey, optimize, ordering, size
public HeapModifier(java.io.File heapFile, int keylength, ByteOrder ordering) throws java.io.IOException
heapFile
- keylength
- ordering
- java.io.IOException
public void clear() throws java.io.IOException
public void close(boolean writeIDX)
close
in interface BLOB
close
in class HeapReader
public void close()
close
in class HeapReader
public void finalize()
finalize
in class HeapReader
public void delete(byte[] key) throws java.io.IOException
private void tryMergePreviousGap(long thisSeek) throws java.io.IOException
java.io.IOException
private void tryMergeNextGaps(long thisSeek, int thisSize) throws java.io.IOException
java.io.IOException
private void mergeGaps(long seek0, int size0, long seek1, int size1) throws java.io.IOException
java.io.IOException
protected void shrinkWithGapsAtEnd()
public void insert(byte[] key, byte[] b) throws java.io.IOException
BLOB
public int replace(byte[] key, BLOB.Rewriter rewriter) throws java.io.IOException
BLOB
public int reduce(byte[] key, BLOB.Reducer reducer) throws java.io.IOException, SpaceExceededException
BLOB
reduce
in interface BLOB
key
- the primary keyjava.io.IOException
SpaceExceededException