mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-27 08:22:36 +00:00
accessing vendor-table.json from code
This commit is contained in:
parent
14b13ee8a8
commit
b96b90fdd0
@ -101,6 +101,30 @@ public final class JsonUtils {
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static JsonObject getSpecificJsonObject(final String jsonFilename, final String elementName) {
|
||||
// find the file and load it
|
||||
return getSpecificJsonObject(jsonFilename, elementName, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public static JsonObject getSpecificJsonObject(final String jsonFilename,
|
||||
final String elementName,
|
||||
final Charset charset) {
|
||||
// find the file and load it
|
||||
JsonObject jsonObject = getJsonObject(jsonFilename, charset);
|
||||
|
||||
if (jsonObject != null && jsonObject.get(elementName) != null) {
|
||||
return jsonObject.get(elementName).asObject();
|
||||
}
|
||||
|
||||
return new JsonObject();
|
||||
}
|
||||
public static JsonObject getJsonObject(final String jsonFilename) {
|
||||
return getJsonObject(jsonFilename, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public static JsonObject getJsonObject(final String jsonFilename, final Charset charset) {
|
||||
// find the file and load it
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
|
@ -72,9 +72,13 @@ public class UefiGuid {
|
||||
System.out.println("XXXX EMPTYYYYYYY, before trying to grab file from code");
|
||||
|
||||
|
||||
uefiVendorRef = JsonUtils.getJsonObject("vendor-table2.json",
|
||||
// uefiVendorRef = JsonUtils.getJsonObject("vendor-table2.json",
|
||||
// StandardCharsets.UTF_8);
|
||||
|
||||
uefiVendorRef = JsonUtils.getSpecificJsonObject("vendor-table2.json", "VendorTable",
|
||||
StandardCharsets.UTF_8);
|
||||
|
||||
|
||||
// System.out.println("XXXX getClass: " + getClass());
|
||||
// System.out.println("XXXX getClassResource: " + getClass().getResource("/vendor-table2.json"));
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user