/** * 读取Json文件 * * @return Json字符串 */ public static String readJson() { System.out.println("读取Json配置文件"); String path = Paths.get(System.getProperty("user.dir"), "/conf/archive.json").toString(); BufferedReader reader = null; StringBuffer data = new StringBuffer(); try { reader = new BufferedReader(new FileReader(new File(path))); String temp = null; while ((temp = reader.readLine()) != null) { data.append(temp); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } return data.toString(); }