org.n52.janmayen.Json.loadFile()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中org.n52.janmayen.Json.loadFile()方法的一些代码示例,展示了Json.loadFile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Json.loadFile()方法的具体详情如下:
包路径:org.n52.janmayen.Json
类名称:Json
方法名:loadFile

Json.loadFile介绍

暂无

代码示例

代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common

  1. public ProcessingReport validate(File file, String schema)
  2. throws IOException {
  3. return validate(Json.loadFile(file), schema);
  4. }

代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common

  1. public boolean isValid(File file, String schema)
  2. throws IOException {
  3. return isValid(Json.loadFile(file), schema);
  4. }

代码示例来源:origin: org.n52.faroe/faroe-json

  1. /**
  2. * Reads the configuration, if the file exists.
  3. *
  4. * @param f the file holding the configuration
  5. *
  6. * @return the decoded JSON object
  7. */
  8. private Optional<ObjectNode> readConfiguration(File f) {
  9. if (!f.exists()) {
  10. return Optional.empty();
  11. }
  12. if (!f.isFile()) {
  13. throw new ConfigurationError("%s is not a file", f.getAbsolutePath());
  14. }
  15. if (!f.canRead()) {
  16. throw new ConfigurationError("%s is not a readable file", f.getAbsolutePath());
  17. }
  18. try {
  19. JsonNode node = Json.loadFile(f);
  20. if (!node.isObject()) {
  21. throw new ConfigurationError("%s does not contain a JSON object", f.getAbsolutePath());
  22. }
  23. return Optional.of((ObjectNode) node);
  24. } catch (IOException ex) {
  25. throw new ConfigurationError("Could not read " + f.getAbsolutePath(), ex);
  26. }
  27. }

代码示例来源:origin: org.n52.sensorweb.sos/profile-coding

  1. private void loadProfiles() throws OwsExceptionReport {
  2. for (File file : loadFiles()) {
  3. try {
  4. JsonNode profiles = Json.loadFile(file);
  5. ProfileParser pp = new ProfileParser();
  6. JsonNode pNode = profiles.path(PROFILES);
  7. if (pNode.isArray()) {
  8. for (int i = 0; i < pNode.size(); i++) {
  9. Profile profile = pp.parseProfile(pNode.get(i));
  10. addProfile(profile);
  11. }
  12. } else {
  13. Profile profile = pp.parseProfile(pNode);
  14. addProfile(profile);
  15. }
  16. } catch (IOException ioe) {
  17. throw new NoApplicableCodeException().causedBy(ioe).withMessage("Error while loading profies file.");
  18. }
  19. }
  20. }

代码示例来源:origin: 52North/SOS

  1. private void loadProfiles() throws OwsExceptionReport {
  2. for (File file : loadFiles()) {
  3. try {
  4. JsonNode profiles = Json.loadFile(file);
  5. ProfileParser pp = new ProfileParser();
  6. JsonNode pNode = profiles.path(PROFILES);
  7. if (pNode.isArray()) {
  8. for (int i = 0; i < pNode.size(); i++) {
  9. Profile profile = pp.parseProfile(pNode.get(i));
  10. addProfile(profile);
  11. }
  12. } else {
  13. Profile profile = pp.parseProfile(pNode);
  14. addProfile(profile);
  15. }
  16. } catch (IOException ioe) {
  17. throw new NoApplicableCodeException().causedBy(ioe).withMessage("Error while loading profies file.");
  18. }
  19. }
  20. }

相关文章