@TopNS(prefix="", value="sst", uri="http://schemas.openxmlformats.org/spreadsheetml/2006/main") public class SharedStrings extends Object implements Storable, Closeable
SST saves characters and strings sequentially. When writing a string,
it first determines whether it exists. If it exists, returns the index
in the Table (zero base), otherwise add it in to the last element of
Table and returns the current subscript.
Introduced Google BloomFilter to increase filtering speed, the
BloomFilter estimates the amount of data to be 1 million, and the false
positive rate is 0.3%. When the number exceeds 2^17,
it will be converted to inline string.
A hot zone is also designed internally to cache multiple occurrences,
the default size is 512, and the LRU elimination algorithm is used.
If the cache misses, it will be read from in temp file and flushed to the
cache.
Characters are handled differently. ASCII characters use the built-in array
cache subscript. The over 0x7F characters will be converted to strings and
searched using strings.
public int get(char c)
throws IOException
c - the character valueIOException - if I/O error occurpublic int get(String key) throws IOException
key - the string valueIOException - if I/O error occurpublic void writeTo(Path root) throws IOException
StorablewriteTo 在接口中 Storableroot - the parent pathIOException - if io error occurpublic void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableIOExceptionCopyright © 2020. All rights reserved.