标签:throws url string class java obj tst aac throw
public class URLDownload {
public static void main(String[] args) throws IOException {
URL url=new URL("https://m10.music.126.net/20210204001424/b2ecdfbfe13e0b8bb4246a9ea827eeae/yyaac/obj/wonDkMOGw6XDiTHCmMOi/2025798093/8cc2/2f5e/bc24/4d305f5b282b778fca0c8c57f08ebe7e.m4a");
HttpURLConnection uc=(HttpURLConnection)url.openConnection();
InputStream is=uc.getInputStream();
FileOutputStream fos=new FileOutputStream(new File("d:/a"));
byte[] buffer=new byte[1024];
int len;
while((len=is.read(buffer))!=-1) {
fos.write(buffer,0,len);
}
fos.close();
is.close();
uc.disconnect();
}
}
标签:throws url string class java obj tst aac throw
原文地址:https://www.cnblogs.com/zhang-han/p/14370465.html