public Properties getAppletProperties(String worldprefix) throws IOException { Properties p = new Properties(); p.setProperty("width", "765"); p.setProperty("height", "503"); URL url = new URL("http://" + worldprefix + ".runescape.com/lang/en/aff/runescape/game.ws?lowmem=1&plugin=0"); byte[] b = Tools.readAllFromStream(url.openStream()); String page = new String(b); page = page.substring(page.indexOf("")); page = page.substring(page.indexOf(">") + 1); String[] lines = page.split("\\n"); for (String line : lines) { StringTokenizer tok = new StringTokenizer(line, "<> ="); if (!tok.hasMoreTokens()) continue; tok.nextToken(); tok.nextToken(); String key = tok.nextToken(); tok.nextToken(); p.setProperty(key, tok.nextToken()); } return p; } public static byte[] readAllFromStream(InputStream in) throws IOException { int buf = 1024; byte[] tmp = new byte[buf]; byte[] newbuf = new byte[0]; int read = -1; int count = 0; while ((read = in.read(tmp)) > -1) { count += read; byte[] tmp1 = newbuf; newbuf = new byte[count]; if (tmp1.length > 0) System.arraycopy(tmp1, 0, newbuf, 0, tmp1.length); System.arraycopy(tmp, 0, newbuf, tmp1.length, read); tmp = new byte[buf]; } return newbuf; }