我后台获取到的视频url是http+域名的那种,怎么根据它获取到视频的时长、大小。在线等,加急,大神们,快开始你们的表演!
4条回答 默认 最新
- 一缕清风007 2017-11-07 03:45关注
包导对了怎么可能找不到方法,仔细检查一下。
package getOracleTableInfo; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; public class NetFileTest { public static void main(String[] args) throws IOException { URL url = new URL("http://imgs.yeepay.com/img/1509532856977_GICCshouye20171101.jpg"); HttpURLConnection urlcon = (HttpURLConnection) url.openConnection(); // 根据响应获取文件大小 int fileLength = urlcon.getContentLength(); System.out.println(fileLength); } }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决评论 打赏 举报无用 2