【记录】根据链接地址URL判断文件类型

判断类型的代码 
try {
String report = "www.baidu.com";
URL url = new URL(report);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
BufferedInputStream bis = new BufferedInputStream(connection.getInputStream());
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
int n;
while (-1 != (n = bis.read(buffer))) {
output.write(buffer, 0, n);
}

【记录】根据链接地址URL判断文件类型最先出现在Python成神之路

版权声明:
作者:zhangchen
链接:https://www.techfm.club/p/20915.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>