zoukankan      html  css  js  c++  java
  • java 读取json

    http://blog.csdn.net/5iasp/article/details/38545875

    private void readAccount() throws IOException {

    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    byte[] buffer = new byte[1024];
    InputStream fileInputStream = this.getClass().getResourceAsStream("/account.json");
    while (fileInputStream.read(buffer) != -1) {
    outputStream.write(buffer);
    }
    String accountJson = outputStream.toString("UTF-8").trim();
    JSONArray jsonArray = new JSONArray(accountJson);
    log.info(jsonArray.toString());
    for (int index=0; index < jsonArray.length(); index++) {
    JSONObject jsonObject = jsonArray.getJSONObject(index);
    String account = jsonObject.getString("account");
    String password = jsonObject.getString("password");
    String ip = jsonObject.getString("ip");
    String spNum = jsonObject.getString("spNum");
    String spId = jsonObject.getString("spId");
    this.passwordHash.put(account, password);
    this.ipaddressHash.put(account, ip);
    this.spnumHash.put(account, spNum);
    if(spId != null && !spId.equals("")) {
    this.spidHash.put(account, spId);
    }
    }
    }
  • 相关阅读:
    闪回flashback
    Oracle数据文件在open状态被删除的恢复记录
    从浅到深掌握Oracle的锁
    Oracle 11g 11201_RHEL5.5_RAC_VBOX 详细搭建步骤
    AWR Report 关键参数详细分析
    16、Xtrabackup备份与恢复
    17、percona-toolkit
    插入排序
    选择排序
    冒泡排序
  • 原文地址:https://www.cnblogs.com/dinglulu/p/5238968.html
Copyright © 2011-2022 走看看