Here you can find the source of getXmlReport(String fileName)
public static String getXmlReport(String fileName)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; public class Main { private static String reportServletUrl; /**//ww w . j a va 2 s . c o m * Ucitava dati izvestaj preko servleta. */ public static String getXmlReport(String fileName) { String proxyHost = System.getProperty("proxyHost"); String proxyPort = System.getProperty("proxyHost"); System.setProperty("proxyHost", ""); System.setProperty("proxyPort", ""); System.setProperty("proxySet", "false"); StringBuffer buff = new StringBuffer(); try { URL url = new URL(reportServletUrl + "?reportFile=" + fileName); URLConnection conn = url.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader( conn.getInputStream(), "UTF8")); String line = ""; while ((line = in.readLine()) != null) { buff.append(line + "\n"); } in.close(); } catch (Exception ex) { ex.printStackTrace(); } System.setProperty("proxyHost", proxyHost == null ? "" : proxyHost); System.setProperty("proxyPort", proxyPort == null ? "" : proxyPort); System.setProperty("proxySet", proxyHost == null ? "false" : "true"); return buff.toString(); } /** * Ucitava dati izvestaj iz fajl sistema. */ public static String getXmlReport(String fileName, String dir) { File d = new File(dir); File f = new File(d, fileName); StringBuffer buff = new StringBuffer(); try { BufferedReader in = new BufferedReader(new InputStreamReader( new FileInputStream(f), "UTF8")); String line = ""; while ((line = in.readLine()) != null) buff.append(line + "\n"); in.close(); } catch (Exception ex) { ex.printStackTrace(); } return buff.toString(); } }