MCPcopy Index your code
hub / github.com/BombusMod/BombusMod / loadFromFile

Method loadFromFile

src/main/java/IE/UserKeys.java:52–85  ·  view source on GitHub ↗
(String path, boolean fromResource)

Source from the content-addressed store, hash-verified

50 }
51
52 public static KeyScheme loadFromFile(String path, boolean fromResource) {
53 final KeyScheme keyScheme = new KeyScheme();
54
55 Vector[] table = null;
56 if (!fromResource) {
57 FileIO f = FileIO.createConnection(path);
58 try {
59 InputStream in = f.openInputStream();
60 table = new StringLoader().stringLoader(in, 2);
61 f.close();
62 } catch (IOException e) {
63 }
64 } else {
65 table = new StringLoader().stringLoader(path, 2);
66 }
67
68 if (table == null) {
69 return keyScheme;
70 }
71
72 UserKey modificatorKey = UserKey.createFromStrings(
73 (String) table[0].elementAt(0),
74 (String) table[1].elementAt(0));
75
76 keyScheme.setModificatorCode(modificatorKey.key);
77
78 for (int i = 1; i < table[0].size(); i++) {
79 keyScheme.addKey(UserKey.createFromStrings(
80 (String) table[0].elementAt(i),
81 (String) table[1].elementAt(i)));
82 }
83
84 return keyScheme;
85 }
86
87 public static void rmsUpdate(KeyScheme keyScheme) {
88 DataOutputStream outputStream = NvStorage.CreateDataOutputStream();

Callers 2

UserKeysMethod · 0.95
UserKeyExecMethod · 0.80

Calls 8

createConnectionMethod · 0.95
openInputStreamMethod · 0.95
closeMethod · 0.95
createFromStringsMethod · 0.95
setModificatorCodeMethod · 0.95
addKeyMethod · 0.95
stringLoaderMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected