|
@@ -58,7 +58,7 @@ public final class Downloader {
|
58
|
58
|
* @throws java.net.MalformedURLException If the URL is malformed
|
59
|
59
|
* @throws java.io.IOException If there's an I/O error while downloading
|
60
|
60
|
*/
|
61
|
|
- public static List<String> getPage(final String url)
|
|
61
|
+ public static String getPage(final String url)
|
62
|
62
|
throws MalformedURLException, IOException {
|
63
|
63
|
|
64
|
64
|
return getPage(url, "");
|
|
@@ -66,17 +66,18 @@ public final class Downloader {
|
66
|
66
|
|
67
|
67
|
/**
|
68
|
68
|
* Retrieves the specified page, sending the specified post data.
|
69
|
|
- *
|
|
69
|
+ *
|
|
70
|
+ * TODO: Update
|
70
|
71
|
* @param url The URL to retrieve
|
71
|
72
|
* @param postData The raw POST data to send
|
72
|
73
|
* @return A list of lines received from the server
|
73
|
74
|
* @throws java.net.MalformedURLException If the URL is malformed
|
74
|
75
|
* @throws java.io.IOException If there's an I/O error while downloading
|
75
|
76
|
*/
|
76
|
|
- public static List<String> getPage(final String url, final String postData)
|
|
77
|
+ public static String getPage(final String url, final String postData)
|
77
|
78
|
throws MalformedURLException, IOException {
|
78
|
79
|
|
79
|
|
- final List<String> res = new ArrayList<String>();
|
|
80
|
+ final StringBuilder res = new StringBuilder();
|
80
|
81
|
|
81
|
82
|
final URLConnection urlConn = getConnection(url, postData);
|
82
|
83
|
|
|
@@ -89,25 +90,26 @@ public final class Downloader {
|
89
|
90
|
line = in.readLine();
|
90
|
91
|
|
91
|
92
|
if (line != null) {
|
92
|
|
- res.add(line);
|
|
93
|
+ res.append(line);
|
93
|
94
|
}
|
94
|
95
|
} while (line != null);
|
95
|
96
|
|
96
|
97
|
in.close();
|
97
|
98
|
|
98
|
|
- return res;
|
|
99
|
+ return res.toString();
|
99
|
100
|
}
|
100
|
101
|
|
101
|
102
|
/**
|
102
|
103
|
* Retrieves the specified page, sending the specified post data.
|
103
|
|
- *
|
|
104
|
+ *
|
|
105
|
+ * TODO: Update
|
104
|
106
|
* @param url The URL to retrieve
|
105
|
107
|
* @param postData A map of post data that should be sent
|
106
|
108
|
* @return A list of lines received from the server
|
107
|
109
|
* @throws java.net.MalformedURLException If the URL is malformed
|
108
|
110
|
* @throws java.io.IOException If there's an I/O error while downloading
|
109
|
111
|
*/
|
110
|
|
- public static List<String> getPage(final String url, final Map<String, String> postData)
|
|
112
|
+ public static String getPage(final String url, final Map<String, String> postData)
|
111
|
113
|
throws MalformedURLException, IOException {
|
112
|
114
|
return getPage(url, encodeArguments(postData));
|
113
|
115
|
}
|