public class ImageUtils {
// 图片size
public static int size;
/**
* 根据图片地址返回图片大小kb或者 Mb
*
* @param imgPath 图片地址
* @return
*/
public static void pathSize(String imgPath){
int urlSize;
URL url = new URL(imgPath);
URLConnection conn = url.openConnection();
urlSize = conn.getContentLength();
size = urlSize / 1024 ;
conn.getInputStream().close();
}
public static void main(String[] args) throws Exception {
pathSize("");
}
}
05-17
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交