如何使用java下载数据集
我想做一个应用程序,将下载所有的文件中提到的图像作为输入域。我可以从其他网站下载一个文件,但无法下载纸质形式的acm数字图书馆。 我需要做的是下载整个数据集 下面是我用来下载单个文件的代码如何使用java下载数据集,java,dataset,Java,Dataset,我想做一个应用程序,将下载所有的文件中提到的图像作为输入域。我可以从其他网站下载一个文件,但无法下载纸质形式的acm数字图书馆。 我需要做的是下载整个数据集 下面是我用来下载单个文件的代码 String fileName = "1.txt"; URL link = new URL("http://shayconcepts.com"); InputStream in = new BufferedInputStream(link.openStream());
String fileName = "1.txt";
URL link = new URL("http://shayconcepts.com");
InputStream in = new BufferedInputStream(link.openStream());
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buf = new byte[2048];
int n = 0;
while (-1!=(n=in.read(buf)))
{
out.write(buf, 0, n);
}
out.close();
in.close();
byte[] response = out.toByteArray();
FileOutputStream fos = new FileOutputStream(fileName);
fos.write(response);
fos.close();
我如何修改它以下载整个数据集没有人回答我的问题:(