sharedStringsLoader load shared string table from system temporary file to memory, and reset shared string table for reader.
()
| 462 | // sharedStringsLoader load shared string table from system temporary file to |
| 463 | // memory, and reset shared string table for reader. |
| 464 | func (f *File) sharedStringsLoader() (err error) { |
| 465 | f.mu.Lock() |
| 466 | defer f.mu.Unlock() |
| 467 | if path, ok := f.tempFiles.Load(defaultXMLPathSharedStrings); ok { |
| 468 | f.Pkg.Store(defaultXMLPathSharedStrings, f.readBytes(defaultXMLPathSharedStrings)) |
| 469 | f.tempFiles.Delete(defaultXMLPathSharedStrings) |
| 470 | if err = os.Remove(path.(string)); err != nil { |
| 471 | return |
| 472 | } |
| 473 | f.SharedStrings = nil |
| 474 | } |
| 475 | if f.sharedStringTemp != nil { |
| 476 | if err := f.sharedStringTemp.Close(); err != nil { |
| 477 | return err |
| 478 | } |
| 479 | f.tempFiles.Delete(defaultTempFileSST) |
| 480 | f.sharedStringItem, err = nil, os.Remove(f.sharedStringTemp.Name()) |
| 481 | f.sharedStringTemp = nil |
| 482 | } |
| 483 | return |
| 484 | } |
| 485 | |
| 486 | // setSharedString provides a function to add string to the share string table. |
| 487 | func (f *File) setSharedString(val string) (int, error) { |
no test coverage detected