import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
public class test {
public String getForge(String version) {
URL url;
HttpURLConnection web;
try {
url = new URL("https://api.prws.kr/MCLatestForgeVersion?ver=" + version);
web = (HttpURLConnection) url.openConnection();
web.setRequestMethod("GET");
web.setConnectTimeout(10000);
web.connect();
InputStream in = web.getInputStream();
byte[] buf = new byte[1024 * 8];
int length = 0;
ByteArrayOutputStream out = new ByteArrayOutputStream();
while ((length = in.read(buf)) != -1) {
out.write(buf, 0, length);
}
return new String(out.toByteArray(),"UTF-8").split("\"")[11];
} catch (Exception e) {
return e + "";
}
}
/*출처
*/
mchang
2020.05.22오.뭔 말인지 하나도 모르겠다...
마크러버
2020.05.22뭔지 이해가 가지 않는다
나만드런가?
qkrwnsdud12345
2020.05.25뭔 말인지 하나도 모르겠는데 되게 멋지다;;;