mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Mage.Stats WS module for getting server stats in json format
This commit is contained in:
parent
78c0d76088
commit
71614becc2
43 changed files with 1587 additions and 0 deletions
32
Mage.Stats/src/test/java/com/anygo/ws/util/FileUtil.java
Normal file
32
Mage.Stats/src/test/java/com/anygo/ws/util/FileUtil.java
Normal 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();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue