public class SharedStrings extends Object implements Closeable
For large files, it is impossible to load all data into the memory and get it by index. The current practice is to partition and divide the data into three areas: forward, backward, and hot. The newly read data is placed in the forward area, if not found in forward area, go to the backward area to find, finally go to the hot area to find it. If not found in the three areas, press the ward will be re-load in to the forward area. The original forwarding area data is copied to the backward area. The blocks loaded twice will be marked, the marked blocks will be placed in the hot area when they are repeatedly read, and the hot area will be eliminated by the LRU page replacement algorithm.
public int size()
public String get(int index)
index - the index of SharedStringTablepublic void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableIOExceptionCopyright © 2020. All rights reserved.