public class SharedStrings extends Object implements Closeable
This record contains a list of all strings used anywhere in the workbook. Each string occurs only once. The workbook uses indexes into the list to reference the strings
| 构造器和说明 |
|---|
SharedStrings(IndexSharedStringTable sst,
int cacheSize,
int hotSize)
Constructs a SharedStrings with a
IndexSharedStringTable |
SharedStrings(InputStream is,
int cacheSize,
int hotSize)
Constructs a SharedString with the xml path, please call
load() after instance |
SharedStrings(String[] data)
Constructs a SharedStrings containing the elements of the
specified data array
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
close stream and free space
|
static String |
escape(char[] cb,
int from,
int to)
escape
|
String |
get(int index)
Getting the strings value by index
|
SharedStrings |
load()
Load the sharedString.xml file and instance word cache
|
protected int |
readData()
Read data from main reader
forward only
|
protected void |
readMore()
Load string record from xml
|
int |
size() |
static int |
tableSizeFor(int cap)
Returns a power of two size for the given target capacity.
|
String |
toString() |
public SharedStrings(String[] data)
data - the shared stringspublic SharedStrings(InputStream is, int cacheSize, int hotSize)
load() after instanceis - the xml file pathcacheSize - the number of word per loadhotSize - the number of high frequency wordpublic SharedStrings(IndexSharedStringTable sst, int cacheSize, int hotSize) throws IOException
IndexSharedStringTablesst - IndexSharedStringTablecacheSize - the number of word per loadhotSize - the number of high frequency wordIOException - if I/O error occur.public int size()
public static int tableSizeFor(int cap)
cap - the custom buffer sizepublic SharedStrings load() throws IOException
SharedStringsIOException - if io error occurpublic String get(int index)
index - the index of SharedStringTableprotected void readMore()
protected int readData()
throws IOException
IOException - if I/O error occurpublic static String escape(char[] cb, int from, int to)
cb - source char bufferfrom - starting position in the source array.to - ending position in the source array.public void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableIOExceptionCopyright © 2025. All rights reserved.