(String path, boolean fromResource)
| 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(); |
no test coverage detected