public static void downloadFiles
(String strURL,
String strPath,
int buffSize
) { try {
URL connection
= new URL(strURL
); urlconn.setRequestMethod("GET");
urlconn.connect();
in = urlconn.getInputStream();
byte buffer[] = new byte[buffSize];
int c = in.read(buffer);
while (c > 0) {
writer.write(buffer, 0, c);
c = in.read(buffer);
}
writer.flush();
writer.close();
in.close();
}
}
CXB1YmxpYyBzdGF0aWMgdm9pZCBkb3dubG9hZEZpbGVzKFN0cmluZyBzdHJVUkwsIFN0cmluZyBzdHJQYXRoLCBpbnQgYnVmZlNpemUpIHsKICAgICAgICB0cnkgewogICAgICAgICAgICBVUkwgY29ubmVjdGlvbiA9IG5ldyBVUkwoc3RyVVJMKTsKICAgICAgICAgICAgSHR0cFVSTENvbm5lY3Rpb24gdXJsY29ubjsKICAgICAgICAgICAgdXJsY29ubiA9IChIdHRwVVJMQ29ubmVjdGlvbikgY29ubmVjdGlvbi5vcGVuQ29ubmVjdGlvbigpOwogICAgICAgICAgICB1cmxjb25uLnNldFJlcXVlc3RNZXRob2QoIkdFVCIpOwogICAgICAgICAgICB1cmxjb25uLmNvbm5lY3QoKTsKICAgICAgICAgICAgSW5wdXRTdHJlYW0gaW4gPSBudWxsOwogICAgICAgICAgICBpbiA9IHVybGNvbm4uZ2V0SW5wdXRTdHJlYW0oKTsKICAgICAgICAgICAgT3V0cHV0U3RyZWFtIHdyaXRlciA9IG5ldyBGaWxlT3V0cHV0U3RyZWFtKHN0clBhdGgpOwogICAgICAgICAgICBieXRlIGJ1ZmZlcltdID0gbmV3IGJ5dGVbYnVmZlNpemVdOwogICAgICAgICAgICBpbnQgYyA9IGluLnJlYWQoYnVmZmVyKTsKICAgICAgICAgICAgd2hpbGUgKGMgPiAwKSB7CiAgICAgICAgICAgICAgICB3cml0ZXIud3JpdGUoYnVmZmVyLCAwLCBjKTsKICAgICAgICAgICAgICAgIGMgPSBpbi5yZWFkKGJ1ZmZlcik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgd3JpdGVyLmZsdXNoKCk7CiAgICAgICAgICAgIHdyaXRlci5jbG9zZSgpOwogICAgICAgICAgICBpbi5jbG9zZSgpOwogICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKGUpOwogICAgICAgIH0KCiAgICB9
Main.java:1: error: class, interface, or enum expected
public static void downloadFiles(String strURL, String strPath, int buffSize) {
^
Main.java:4: error: class, interface, or enum expected
HttpURLConnection urlconn;
^
Main.java:5: error: class, interface, or enum expected
urlconn = (HttpURLConnection) connection.openConnection();
^
Main.java:6: error: class, interface, or enum expected
urlconn.setRequestMethod("GET");
^
Main.java:7: error: class, interface, or enum expected
urlconn.connect();
^
Main.java:8: error: class, interface, or enum expected
InputStream in = null;
^
Main.java:9: error: class, interface, or enum expected
in = urlconn.getInputStream();
^
Main.java:10: error: class, interface, or enum expected
OutputStream writer = new FileOutputStream(strPath);
^
Main.java:11: error: class, interface, or enum expected
byte buffer[] = new byte[buffSize];
^
Main.java:12: error: class, interface, or enum expected
int c = in.read(buffer);
^
Main.java:13: error: class, interface, or enum expected
while (c > 0) {
^
Main.java:15: error: class, interface, or enum expected
c = in.read(buffer);
^
Main.java:16: error: class, interface, or enum expected
}
^
Main.java:18: error: class, interface, or enum expected
writer.close();
^
Main.java:19: error: class, interface, or enum expected
in.close();
^
Main.java:20: error: class, interface, or enum expected
} catch (IOException e) {
^
Main.java:22: error: class, interface, or enum expected
}
^
17 errors