Package org.eclipse.net4j.util.io
Class SortedFileMap<K extends java.lang.Comparable<K>,V>
- java.lang.Object
-
- org.eclipse.net4j.util.io.SortedFileMap<K,V>
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
CachedFileMap
public abstract class SortedFileMap<K extends java.lang.Comparable<K>,V> extends java.lang.Object implements java.io.Closeable
- Author:
- Eike Stepper
-
-
Constructor Summary
Constructors Constructor Description SortedFileMap(java.io.File file, java.lang.String mode)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
V
get(K key)
long
getEntryCount()
int
getEntrySize()
java.io.File
getFile()
K
getKey(long index)
abstract int
getKeySize()
K
getMaxKey()
long
getPosition(long index)
java.io.RandomAccessFile
getRandomAccessFile()
V
getValue(long index)
long
getValuePosition(long index)
abstract int
getValueSize()
V
put(K key, V value)
protected abstract K
readKey(ExtendedDataInput in)
protected abstract V
readValue(ExtendedDataInput in)
protected long
search(K key)
protected abstract void
writeKey(ExtendedDataOutput out, K key)
protected abstract void
writeValue(ExtendedDataOutput out, V value)
-
-
-
Method Detail
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
getFile
public java.io.File getFile()
-
getRandomAccessFile
public java.io.RandomAccessFile getRandomAccessFile()
-
getEntryCount
public long getEntryCount()
-
getEntrySize
public int getEntrySize()
-
getPosition
public long getPosition(long index)
-
getValuePosition
public long getValuePosition(long index)
-
getMaxKey
public K getMaxKey()
-
getKey
public K getKey(long index)
-
getValue
public V getValue(long index)
-
search
protected long search(K key) throws java.io.IOException
- Returns:
- The index of the entry with the given key if the key exists,
-(insertionIndex + 1)
otherwise. - Throws:
java.io.IOException
-
getKeySize
public abstract int getKeySize()
-
readKey
protected abstract K readKey(ExtendedDataInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
writeKey
protected abstract void writeKey(ExtendedDataOutput out, K key) throws java.io.IOException
- Throws:
java.io.IOException
-
getValueSize
public abstract int getValueSize()
-
readValue
protected abstract V readValue(ExtendedDataInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
writeValue
protected abstract void writeValue(ExtendedDataOutput out, V value) throws java.io.IOException
- Throws:
java.io.IOException
-
-