Mage.Stats WS module for getting server stats in json format

This commit is contained in:
magenoxx 2014-08-27 03:38:43 +04:00
parent 78c0d76088
commit 71614becc2
43 changed files with 1587 additions and 0 deletions

View file

@ -0,0 +1,32 @@
package com.anygo.ws.util;
import java.io.*;
/**
*
* @author noxx
*/
public class FileUtil {
private FileUtil() {}
public static String readFile(String file) throws IOException {
InputStream in = FileUtil.class.getResourceAsStream(file);
if (in == null) {
throw new FileNotFoundException("Couldn't find file " + file);
}
Reader fr = new InputStreamReader(in, "utf-8");
BufferedReader reader = new BufferedReader(fr);
String line;
StringBuilder stringBuilder = new StringBuilder();
String ls = System.getProperty("line.separator");
while ((line = reader.readLine()) != null) {
stringBuilder.append(line);
stringBuilder.append(ls);
}
return stringBuilder.toString();
}
}