可以使用 Java 的 URL
类和 URLConnection
类来下载文件。例如:
URL url= new URL("http://example.com/file.txt");
URLConnection connection = url.openConnection();
InputStream in = connection.getInputStream();
FileOutputStream out = new FileOutputStream("file.txt");
byte[] b = new byte[1024];
int count;
while (