Package com.graphhopper.search
Class KVStorage
java.lang.Object
com.graphhopper.search.KVStorage
This class stores key-value pairs in an append-only manner.
- Author:
- Peter Karich
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
add
(List<KVStorage.KeyValue> entries) This method writes the specified entryMap (key-value pairs) into the storage.void
clear()
void
close()
create
(long initBytes) static String
This method limits the specified String value to the length currently accepted for values in the KVStorage.void
flush()
getAll
(long entryPointer) long
getMap
(long entryPointer) Please note that this method ignores potentially different tags for forward and backward direction.boolean
isClosed()
boolean
-
Constructor Details
-
KVStorage
Specify a larger cacheSize to reduce disk usage. Note that this increases the memory usage of this object.
-
-
Method Details
-
create
-
loadExisting
public boolean loadExisting() -
add
This method writes the specified entryMap (key-value pairs) into the storage. Please note that null keys or null values are rejected. The Class of a value can be only: byte[], String, int, long, float or double (or more precisely, their wrapper equivalent). For all other types an exception is thrown. The first call of add assigns a Class to every key in the Map and future calls of add will throw an exception if this Class differs.- Returns:
- entryPointer with which you can later fetch the entryMap via the get or getAll method
-
getAll
-
getMap
Please note that this method ignores potentially different tags for forward and backward direction. To avoid this usegetAll(long)
instead. -
get
-
flush
public void flush() -
clear
public void clear() -
close
public void close() -
isClosed
public boolean isClosed() -
getCapacity
public long getCapacity() -
cutString
This method limits the specified String value to the length currently accepted for values in the KVStorage.
-