本文整理了Java中org.n52.janmayen.Json.loadFile()
方法的一些代码示例,展示了Json.loadFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Json.loadFile()
方法的具体详情如下:
包路径:org.n52.janmayen.Json
类名称:Json
方法名:loadFile
暂无
代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common
public ProcessingReport validate(File file, String schema)
throws IOException {
return validate(Json.loadFile(file), schema);
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common
public boolean isValid(File file, String schema)
throws IOException {
return isValid(Json.loadFile(file), schema);
}
代码示例来源:origin: org.n52.faroe/faroe-json
/**
* Reads the configuration, if the file exists.
*
* @param f the file holding the configuration
*
* @return the decoded JSON object
*/
private Optional<ObjectNode> readConfiguration(File f) {
if (!f.exists()) {
return Optional.empty();
}
if (!f.isFile()) {
throw new ConfigurationError("%s is not a file", f.getAbsolutePath());
}
if (!f.canRead()) {
throw new ConfigurationError("%s is not a readable file", f.getAbsolutePath());
}
try {
JsonNode node = Json.loadFile(f);
if (!node.isObject()) {
throw new ConfigurationError("%s does not contain a JSON object", f.getAbsolutePath());
}
return Optional.of((ObjectNode) node);
} catch (IOException ex) {
throw new ConfigurationError("Could not read " + f.getAbsolutePath(), ex);
}
}
代码示例来源:origin: org.n52.sensorweb.sos/profile-coding
private void loadProfiles() throws OwsExceptionReport {
for (File file : loadFiles()) {
try {
JsonNode profiles = Json.loadFile(file);
ProfileParser pp = new ProfileParser();
JsonNode pNode = profiles.path(PROFILES);
if (pNode.isArray()) {
for (int i = 0; i < pNode.size(); i++) {
Profile profile = pp.parseProfile(pNode.get(i));
addProfile(profile);
}
} else {
Profile profile = pp.parseProfile(pNode);
addProfile(profile);
}
} catch (IOException ioe) {
throw new NoApplicableCodeException().causedBy(ioe).withMessage("Error while loading profies file.");
}
}
}
代码示例来源:origin: 52North/SOS
private void loadProfiles() throws OwsExceptionReport {
for (File file : loadFiles()) {
try {
JsonNode profiles = Json.loadFile(file);
ProfileParser pp = new ProfileParser();
JsonNode pNode = profiles.path(PROFILES);
if (pNode.isArray()) {
for (int i = 0; i < pNode.size(); i++) {
Profile profile = pp.parseProfile(pNode.get(i));
addProfile(profile);
}
} else {
Profile profile = pp.parseProfile(pNode);
addProfile(profile);
}
} catch (IOException ioe) {
throw new NoApplicableCodeException().causedBy(ioe).withMessage("Error while loading profies file.");
}
}
}
内容来源于网络,如有侵权,请联系作者删除!