MCPcopy
hub / github.com/runelite/runelite / DBTableManager

Class DBTableManager

cache/src/main/java/net/runelite/cache/DBTableManager.java:41–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39import net.runelite.cache.fs.Store;
40
41public class DBTableManager
42{
43 private final Store store;
44 private final Map<Integer, DBTableDefinition> tables = new HashMap<>();
45
46 public DBTableManager(Store store)
47 {
48 this.store = store;
49 }
50
51 public void load() throws IOException
52 {
53 DBTableLoader loader = new DBTableLoader();
54
55 Storage storage = store.getStorage();
56 Index index = store.getIndex(IndexType.CONFIGS);
57 Archive archive = index.getArchive(ConfigType.DBTABLE.getId());
58
59 // just in case the loader is being run on a cache that doesn't have them
60 if (archive == null)
61 {
62 return;
63 }
64
65 byte[] archiveData = storage.loadArchive(archive);
66 ArchiveFiles files = archive.getFiles(archiveData);
67
68 for (FSFile f : files.getFiles())
69 {
70 DBTableDefinition table = loader.load(f.getFileId(), f.getContents());
71 tables.put(f.getFileId(), table);
72 }
73 }
74
75 public Collection<DBTableDefinition> getTables()
76 {
77 return Collections.unmodifiableCollection(tables.values());
78 }
79
80 public DBTableDefinition get(int tableId)
81 {
82 return tables.get(tableId);
83 }
84}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected