@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.
| 构造器和说明 |
|---|
SharedStrings() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close() |
int |
get(char c)
Getting the character value index (zero base)
|
int |
get(String key)
Getting the string value from cache (zero base)
|
SharedStrings |
init()
Create a temp file to storage all text cells
|
void |
writeTo(Path root)
写入指定路径,传入的参数可以是一个文件也可以是文件夹,需要在实现类具体处理
|
public SharedStrings init()
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 - 父级文件夹或文件绝对路径IOException - 写失败异常public void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableIOExceptionCopyright © 2024. All rights reserved.