-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpConnectionHandler.java
More file actions
35 lines (28 loc) · 986 Bytes
/
Copy pathHttpConnectionHandler.java
File metadata and controls
35 lines (28 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package cs249.finalProject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.net.URL;
import java.net.URLConnection;
public class HttpConnectionHandler implements Serializable
{
public HttpConnectionHandler() {
// TODO Auto-generated constructor stub
}
public String getInformation(String URL) throws IOException {
URL RealURL = new URL(URL);
URLConnection conn = RealURL.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
conn.getInputStream()));
StringBuilder response = new StringBuilder();
String inputLine;
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
response.append("\r");
}
in.close();
return response.toString();
}
}