@TopNS(prefix="", value="sst", uri="http://schemas.openxmlformats.org/spreadsheetml/2006/main") public class SharedStrings extends Object implements Storageable, AutoCloseable
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.03%. When the number exceeds 1 million, it will be carried out, redistributing 2 times the length of the space, the maximum length 2^26, When the number exceeds 2^26, it will be converted to inline string.
A hot zone is also designed internally to cache multiple occurrences, the default size is 1024, 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.
Created by guanquan.wang on 2017/10/10.
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
StorageablewriteTo 在接口中 Storageableroot - the parent pathIOException - if io error occurpublic void close()
throws IOException
close 在接口中 AutoCloseableIOExceptionCopyright © 2019. All rights reserved.