Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>No, not build in. But, you could create a crawler that scans your entire hard drive for files with certain extensions ( or even better, MIME types ).</p> <p>Check out this answer for an easy way to iterate through directories: <a href="https://stackoverflow.com/a/3154523/691606">https://stackoverflow.com/a/3154523/691606</a></p> <p>See also <a href="http://www.rgagnon.com/javadetails/java-0487.html" rel="nofollow noreferrer">Get the Mime Type from a File</a>. Based on 1st 2 (of 3) techniques shown therein, is this:</p> <pre><code>import javax.activation.MimetypesFileTypeMap; import java.io.File; class MimeForMedia { public static void main(String[] args) { String[] types = { "png", "jpg", "gif", "tif", "bmp", // image "snd", "wav", "mp3", "ogg", "au", // sound "mov", "avi", "mpg", "flv" // video }; MimetypesFileTypeMap typeMap = new MimetypesFileTypeMap(); for (String type : types) { String name = "a." + type; String bestType = typeMap.getContentType(name); if (bestType.equals("application/octet-stream")) { System.out.print( "Using URLConnection: " ); try { bestType = (new File(name)).toURI().toURL() .openConnection().getContentType(); } catch(Exception e) { System.out.println( e.getMessage() ); } } System.out.println (type + " " + bestType); } } } </code></pre> <p>Here are the results on a Windows 7 PC.</p> <pre><code>Using URLConnection: png image/png jpg image/jpeg gif image/gif tif image/tiff Using URLConnection: bmp content/unknown Using URLConnection: snd audio/basic wav audio/x-wav Using URLConnection: mp3 content/unknown Using URLConnection: ogg content/unknown au audio/basic mov video/quicktime avi video/x-msvideo mpg video/mpeg Using URLConnection: flv content/unknown Press any key to continue . . . </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload