监测url是不是包含图片

监测url是否包含图片URLConnection connection new URL(http://foo.bar/3afv).openConnection()?Stri

监测url是否包含图片

URLConnection connection = new URL("http://foo.bar/3afv").openConnection();?
String contentType = connection.getHeaderField("Content-Type");?
boolean image = contentType.startsWith("image/");?