0
我使用这段代码稍后从URL下载文件。Java URLConnection标头名称
URL url = new URL("http://smarthome-de.censored.net/Installer.zip");
URLConnection conn = url.openConnection();
int size = conn.getContentLength();
String type = conn.getContentType();
有没有办法从URL中捕获文件名? 我可以将“Installer.zip”存储到字符串中,因为它已知,因此无需获取该值。
我找到了getContentType()给我的类型。可悲的是,我没有找到任何名称的方法。